summaryrefslogtreecommitdiff
path: root/runtime/syntax/indent.vim
blob: 9310c4914f70fdf73a3ca8f92fe70eb07fb714be (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
" Vim syntax file
" Language:         indent(1) configuration file
" Maintainer:       Nikolai Weibull <nikolai+work.vim@bitwi.se>
" Latest Revision:  2005-07-04
"   indent_is_bsd:  If exists, will change somewhat to match BSD implementation
"
" TODO: is the deny-all (a la lilo.vim nice or no?)...
"       irritating to be wrong to the last char...
"       would be sweet if right until one char fails

if exists("b:current_syntax")
  finish
endif

let s:cpo_save = &cpo
set cpo&vim

setlocal iskeyword=@,48-57,-,_

syn match   indentError   '\S\+'

syn keyword indentTodo    contained TODO FIXME XXX NOTE

syn region  indentComment start='/\*' end='\*/'
                          \ contains=indentTodo,@Spell
syn region  indentComment start='//' skip='\\$' end='$'
                          \ contains=indentTodo,@Spell

syn keyword indentOptions -bacc --blank-lines-after-ifdefs
                        \ -bad --blank-lines-after-declarations
                        \ -badp --blank-lines-after-procedure-declarations
                        \ -bap --blank-lines-after-procedures
                        \ -bbb --blank-lines-before-block-comments
                        \ -bbo --break-before-boolean-operator
                        \ -bc --blank-lines-after-commas
                        \ -bfda --break-function-decl-args
                        \ -bfde --break-function-decl-args-end
                        \ -bl --braces-after-if-line
                        \ -blf --braces-after-func-def-line
                        \ -bls --braces-after-struct-decl-line
                        \ -br --braces-on-if-line
                        \ -brf --braces-on-func-def-line
                        \ -brs --braces-on-struct-decl-line
                        \ -bs --Bill-Shannon
                        \ -bs --blank-before-sizeof
                        \ -c++ --c-plus-plus
                        \ -cdb --comment-delimiters-on-blank-lines
                        \ -cdw --cuddle-do-while
                        \ -ce --cuddle-else
                        \ -cs --space-after-cast
                        \ -dj --left-justify-declarations
                        \ -eei --extra-expression-indentation
                        \ -fc1 --format-first-column-comments
                        \ -fca --format-all-comments
                        \ -gnu --gnu-style
                        \ -h --help
                        \ -h --usage
                        \ -hnl --honour-newlines
                        \ -kr --k-and-r-style
                        \ -kr --kernighan-and-ritchie
                        \ -kr --kernighan-and-ritchie-style
                        \ -lp --continue-at-parentheses
                        \ -lps --leave-preprocessor-space
                        \ -nbacc --no-blank-lines-after-ifdefs
                        \ -nbad --no-blank-lines-after-declarations
                        \ -nbadp --no-blank-lines-after-procedure-declarations
                        \ -nbap --no-blank-lines-after-procedures
                        \ -nbbb --no-blank-lines-before-block-comments
                        \ -nbbo --break-after-boolean-operator
                        \ -nbc --no-blank-lines-after-commas
                        \ -nbfda --dont-break-function-decl-args
                        \ -nbfde --dont-break-function-decl-args-end
                        \ -nbs --no-Bill-Shannon
                        \ -nbs --no-blank-before-sizeof
                        \ -ncdb --no-comment-delimiters-on-blank-lines
                        \ -ncdw --dont-cuddle-do-while
                        \ -nce --dont-cuddle-else
                        \ -ncs --no-space-after-casts
                        \ -ndj --dont-left-justify-declarations
                        \ -neei --no-extra-expression-indentation
                        \ -nfc1 --dont-format-first-column-comments
                        \ -nfca --dont-format-comments
                        \ -nhnl --ignore-newlines
                        \ -nip --dont-indent-parameters
                        \ -nip --no-parameter-indentation
                        \ -nlp --dont-line-up-parentheses
                        \ -nlps --remove-preprocessor-space
                        \ -npcs --no-space-after-function-call-names
                        \ -npro --ignore-profile
                        \ -nprs --no-space-after-parentheses
                        \ -npsl --dont-break-procedure-type
                        \ -nsaf --no-space-after-for
                        \ -nsai --no-space-after-if
                        \ -nsaw --no-space-after-while
                        \ -nsc --dont-star-comments
                        \ -nsob --leave-optional-blank-lines
                        \ -nss --dont-space-special-semicolon
                        \ -nut --no-tabs
                        \ -nv --no-verbosity
                        \ -o --output
                        \ -o --output-file
                        \ -orig --berkeley
                        \ -orig --berkeley-style
                        \ -orig --original
                        \ -orig --original-style
                        \ -pcs --space-after-procedure-calls
                        \ -pmt --preserve-mtime
                        \ -prs --space-after-parentheses
                        \ -psl --procnames-start-lines
                        \ -saf --space-after-for
                        \ -sai --space-after-if
                        \ -saw --space-after-while
                        \ -sc --start-left-side-of-comments
                        \ -sob --swallow-optional-blank-lines
                        \ -ss --space-special-semicolon
                        \ -st --standard-output
                        \ -ut --use-tabs
                        \ -v --verbose
                        \ -version --version

syn keyword indentOptions -bli --brace-indent
                        \ -c --comment-indentation
                        \ -bli --brace-indent
                        \ -c --comment-indentation
                        \ -cbi --case-brace-indentation
                        \ -cd --declaration-comment-column
                        \ -ci --continuation-indentation
                        \ -cli --case-indentation
                        \ -cp --else-endif-column
                        \ -d --line-comments-indentation
                        \ -di --declaration-indentation
                        \ -i --indent-level
                        \ -ip --parameter-indentation
                        \ -l --line-length
                        \ -lc --comment-line-length
                        \ -pi --paren-indentation
                        \ -ppi --preprocessor-indentation
                        \ -sbi --struct-brace-indentation
                        \ -ts --tab-size
                        \ nextgroup=indenNumber skipwhite
if !exists("indent_is_bsd")
  syn keyword indentOptions -i --indentation-level
                          \ nextgroup=indentNumber skipwhite
endif

syn match   indentNumber  display '\<\d\+\>'

syn keyword indentOptions -T nextgroup=indentIdent skipwhite

syn match   indentIdent   display '\<\h\w*\>'

if exists("indent_is_bsd")
  syn keyword indentOptions -ip -nip -dj -ndj -ei -nei
endif

if exists("c_minlines")
  let b:c_minlines = c_minlines
else
  if !exists("c_no_if0")
    let b:c_minlines = 50       " #if 0 constructs can be long
  else
    let b:c_minlines = 15       " mostly for () constructs
  endif
endif

hi def link indentError   Error
hi def link indentComment Comment
hi def link indentTodo    Todo
hi def link indentOptions Keyword
hi def link indentNumber  Number
hi def link indentIdent   Identifier

let b:current_syntax = "indent"

let &cpo = s:cpo_save
unlet s:cpo_save