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
Graph IRI | Count |
---|---|
http://dbkwik.webdatacommons.org | 14 |