OpenLink Software

Usage stats on Indenting for Qt C++

 Permalink

an Entity in Data Space: 134.155.108.49:8890

Here is a function that can be put in your vimrc, that makes the '=' indent operation work correctly. function! QtCppIndent() " Patterns used to recognise labels and search for the start " of declarations let labelpat='signals:\|slots:\|public:\|protected:\|private:\|Q_OBJECT' let declpat='\(;\|{\|}\)\_s*.' " If the line is a label, it's a no brainer if match(getline(v:lnum),labelpat) != -1 return 0 endif " If the line starts with a closing brace, it's also easy: use cindent if match(getline(v:lnum),'^\s*}') != -1 return cindent(v:lnum) endif " Save cursor position and move to the line we're indenting let pos=getpos('.') call setpos('.',[0,v:lnum,1,0]) " Find the beginning of the previous declaration (this is what " cindent will mimic) call search(declpat,'beW',v:lnum>10?v:lnum-10:0) le

EntityAttributeValueRank
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] This material is Open Knowledge Creative Commons License Valid XHTML + RDFa
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Copyright © 2009-2012 OpenLink Software