aboutsummaryrefslogtreecommitdiff
path: root/after/syntax/c.vim
blob: 4c3b3f0d0ec7f4284ae7230beff5c5da8e41a22a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
setlocal foldenable
setlocal foldmethod=expr
" setlocal foldcolumn=0

" setlocal foldexpr=get(synstack(v:lnum,1),0)==hlID('cComment')
" setlocal foldexpr=len(filter(synstack(v:lnum,indent(v:lnum)+1),'index([hlID(\"cComment\"),hlID(\"cCommentStart\")],v:val)!=-1'))>0
" setlocal foldtext=printf('%*s%.'.eval(&textwidth-indent(v:foldstart)).'S',indent(v:foldstart),'',substitute(substitute(substitute(join(getline(v:foldstart,v:foldend)),'\\s\\s\\+\\\|\[\*\/\]','\ ','g'),'\^\\s\\+','','g'),\ '\\s\\s\\+',\ '\ ',\ 'g')) 
" setlocal foldexpr=index(get(synstack(v:lnum,1),0),hlID('cComment'))>0
" setlocal foldexpr=index(synstack(v:lnum,indent(v:lnum)+1),hlID('cComment'))>0
" setlocal signcolumn=no
" syntax match cType "struct\s+[A-Za-z0-9_]+\>"
" syn clear cStructure
" highlight! link defines Special
syntax match Define "\<[A-Z][A-Z0-9_]*\>"
" syntax match Todo "\/\/ @[A-Z]*\:.*$"
syntax keyword Todo    TODO    contained
syntax match   Comment "//.*"  contains=Todo


" clear default group for a cBlock so we can redefine it without the fold option
syn clear cBlock
syn region cBlock start=/{/ end=/}/ transparent


" configure c.vim so that it automatically allows doxygen like comments
let g:load_doxygen_syntax=1


set formatoptions+=j " Where it makes sense, remove a comment leader when joining lines.
set formatoptions+=1 " Don't break a line after a one-letter word.



" open a corresponding header file
nnorem <leader>gh      :execute 'edit '.findfile(substitute(expand('%:t'),'\.[ch]$','.h',''))<CR>

if filereadable("/usr/bin/vendor_perl/ack")
  autocmd FileType c,cpp  set grepprg=/usr/bin/vendor_perl/ack\ --type=cc\ --nogroup\ --column\ $*
  autocmd FileType c,cpp  set grepformat=%f:%l:%c:%m
endif

" multiple single line comments in a row " broken!
" syn region myCComment start="/\*" end="\*/" fold keepend transparent


" let b:current_syntax    = "c"
" let g:polyglot_disabled = ['c/c++']
" unlet s:ft
" let &cpo = s:cpo_save
" unlet s:cpo_save
..