]> git.proxmox.com Git - mirror_frr.git/blame - tools/frr.vim
lib: Sort zapi_nexthops on the encode
[mirror_frr.git] / tools / frr.vim
CommitLineData
b9a0d38d
DL
1" settings & syntax hilighting for FRR codebase
2" 2019 by David Lamparter, placed in public domain
3
4let c_gnu=1
5
6function! CStyleFRR()
7 syn clear cFormat
8 syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbiuoxXDOUfFeEgGcCsSn]\|[pd]\([A-Z][A-Z0-9]*[a-z]*\|\)\|\[\^\=.[^]]*\]\)" contained
9 syn match cFormat display "%%" contained
10
11 syn keyword cIterator frr_each frr_each_safe frr_each_from
12 syn keyword cMacroOp offsetof container_of container_of_null array_size
13
14 syn keyword cStorageClass atomic
15 syn keyword cFormatConst PRId64 PRIu64 PRIx64
16 syn keyword cFormatConst PRId32 PRIu32 PRIx32
17 syn keyword cFormatConst PRId16 PRIu16 PRIx16
18 syn keyword cFormatConst PRId8 PRIu8 PRIx8
19
20 " you can unlink these by just giving them their own hilighting / color
21 hi link cFormatConst cFormat
22 hi link cIterator cRepeat
23 hi link cMacroOp cOperator
24
25 " indentation
26 setlocal cindent
27 setlocal cinoptions=:0,(0,u4,w1,W8
28 setlocal shiftwidth=8
29 setlocal softtabstop=0
30 setlocal textwidth=0
31 setlocal fo=croql
32 setlocal noet
33endfunction
34
35" auto-apply the above based on path rules
36"autocmd BufRead,BufNewFile /home/.../frr/*.[ch] call CStyleFRR()