summaryrefslogtreecommitdiff
path: root/runtime/syntax/nanorc.vim
blob: 606ac7fdf1e7e3c656f96d045d93bbd03c4f12bf (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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
" Vim syntax file
" Language:             nanorc(5) - GNU nano configuration file
" Previous Maintainer:  Nikolai Weibull <now@bitwi.se>
" Latest Revision:      2006-04-19

if exists("b:current_syntax")
  finish
endif

let s:cpo_save = &cpo
set cpo&vim

syn keyword nanorcTodo          contained TODO FIXME XXX NOTE

syn region  nanorcComment       display oneline start='^\s*#' end='$'
                                \ contains=nanorcTodo,@Spell

syn match   nanorcBegin         display '^'
                                \ nextgroup=nanorcKeyword,nanorcComment
                                \ skipwhite

syn keyword nanorcKeyword       contained set unset
                                \ nextgroup=nanorcBoolOption,
                                \ nanorcStringOption,nanorcNumberOption
                                \ skipwhite

syn keyword nanorcKeyword       contained syntax
                                \ nextgroup=nanorcSynGroupName skipwhite

syn keyword nanorcKeyword       contained color
                                \ nextgroup=@nanorcFGColor skipwhite

syn keyword nanorcBoolOption    contained autoindent backup const cut
                                \ historylog morespace mouse multibuffer
                                \ noconvert nofollow nohelp nowrap preserve
                                \ rebinddelete regexp smarthome smooth suspend
                                \ tempfile view

syn keyword nanorcStringOption  contained backupdir brackets operatingdir
                                \ punct quotestr speller whitespace
                                \ nextgroup=nanorcString skipwhite

syn keyword nanorcNumberOption  contained fill tabsize
                                \ nextgroup=nanorcNumber skipwhite

syn region  nanorcSynGroupName  contained display oneline start=+"+
                                \ end=+"\ze\%([[:blank:]]\|$\)+
                                \ nextgroup=nanorcRegexes skipwhite

syn match   nanorcString        contained display '".*"'

syn region  nanorcRegexes       contained display oneline start=+"+
                                \ end=+"\ze\%([[:blank:]]\|$\)+
                                \ nextgroup=nanorcRegexes skipwhite

syn match   nanorcNumber        contained display '[+-]\=\<\d\+\>'

syn cluster nanorcFGColor       contains=nanorcFGWhite,nanorcFGBlack,
                                \ nanorcFGRed,nanorcFGBlue,nanorcFGGreen,
                                \ nanorcFGYellow,nanorcFGMagenta,nanorcFGCyan,
                                \ nanorcFGBWhite,nanorcFGBBlack,nanorcFGBRed,
                                \ nanorcFGBBlue,nanorcFGBGreen,nanorcFGBYellow,
                                \ nanorcFGBMagenta,nanorcFGBCyan

syn keyword nanorcFGWhite       contained white
                                \ nextgroup=@nanorcFGSpec skipwhite

syn keyword nanorcFGBlack       contained black
                                \ nextgroup=@nanorcFGSpec skipwhite

syn keyword nanorcFGRed         contained red
                                \ nextgroup=@nanorcFGSpec skipwhite

syn keyword nanorcFGBlue        contained blue
                                \ nextgroup=@nanorcFGSpec skipwhite

syn keyword nanorcFGGreen       contained green
                                \ nextgroup=@nanorcFGSpec skipwhite

syn keyword nanorcFGYellow      contained yellow
                                \ nextgroup=@nanorcFGSpec skipwhite

syn keyword nanorcFGMagenta     contained magenta
                                \ nextgroup=@nanorcFGSpec skipwhite

syn keyword nanorcFGCyan        contained cyan
                                \ nextgroup=@nanorcFGSpec skipwhite

syn keyword nanorcFGBWhite      contained brightwhite
                                \ nextgroup=@nanorcFGSpec skipwhite

syn keyword nanorcFGBBlack      contained brightblack
                                \ nextgroup=@nanorcFGSpec skipwhite

syn keyword nanorcFGBRed        contained brightred
                                \ nextgroup=@nanorcFGSpec skipwhite

syn keyword nanorcFGBBlue       contained brightblue
                                \ nextgroup=@nanorcFGSpec skipwhite

syn keyword nanorcFGBGreen      contained brightgreen
                                \ nextgroup=@nanorcFGSpec skipwhite

syn keyword nanorcFGBYellow     contained brightyellow
                                \ nextgroup=@nanorcFGSpec skipwhite

syn keyword nanorcFGBMagenta    contained brightmagenta
                                \ nextgroup=@nanorcFGSpec skipwhite

syn keyword nanorcFGBCyan       contained brightcyan
                                \ nextgroup=@nanorcFGSpec skipwhite

syn cluster nanorcBGColor       contains=nanorcBGWhite,nanorcBGBlack,
                                \ nanorcBGRed,nanorcBGBlue,nanorcBGGreen,
                                \ nanorcBGYellow,nanorcBGMagenta,nanorcBGCyan,
                                \ nanorcBGBWhite,nanorcBGBBlack,nanorcBGBRed,
                                \ nanorcBGBBlue,nanorcBGBGreen,nanorcBGBYellow,
                                \ nanorcBGBMagenta,nanorcBGBCyan

syn keyword nanorcBGWhite       contained white
                                \ nextgroup=@nanorcBGSpec skipwhite

syn keyword nanorcBGBlack       contained black
                                \ nextgroup=@nanorcBGSpec skipwhite

syn keyword nanorcBGRed         contained red
                                \ nextgroup=@nanorcBGSpec skipwhite

syn keyword nanorcBGBlue        contained blue
                                \ nextgroup=@nanorcBGSpec skipwhite

syn keyword nanorcBGGreen       contained green
                                \ nextgroup=@nanorcBGSpec skipwhite

syn keyword nanorcBGYellow      contained yellow
                                \ nextgroup=@nanorcBGSpec skipwhite

syn keyword nanorcBGMagenta     contained magenta
                                \ nextgroup=@nanorcBGSpec skipwhite

syn keyword nanorcBGCyan        contained cyan
                                \ nextgroup=@nanorcBGSpec skipwhite

syn keyword nanorcBGBWhite      contained brightwhite
                                \ nextgroup=@nanorcBGSpec skipwhite

syn keyword nanorcBGBBlack      contained brightblack
                                \ nextgroup=@nanorcBGSpec skipwhite

syn keyword nanorcBGBRed        contained brightred
                                \ nextgroup=@nanorcBGSpec skipwhite

syn keyword nanorcBGBBlue       contained brightblue
                                \ nextgroup=@nanorcBGSpec skipwhite

syn keyword nanorcBGBGreen      contained brightgreen
                                \ nextgroup=@nanorcBGSpec skipwhite

syn keyword nanorcBGBYellow     contained brightyellow
                                \ nextgroup=@nanorcBGSpec skipwhite

syn keyword nanorcBGBMagenta    contained brightmagenta
                                \ nextgroup=@nanorcBGSpec skipwhite

syn keyword nanorcBGBCyan       contained brightcyan
                                \ nextgroup=@nanorcBGSpec skipwhite

syn match   nanorcBGColorSep    contained ',' nextgroup=@nanorcBGColor

syn cluster nanorcFGSpec        contains=nanorcBGColorSep,nanorcRegexes,
                                \ nanorcStartRegion

syn cluster nanorcBGSpec        contains=nanorcRegexes,nanorcStartRegion

syn keyword nanorcStartRegion   contained start nextgroup=nanorcStartRegionEq

syn match   nanorcStartRegionEq contained '=' nextgroup=nanorcRegion

syn region  nanorcRegion        contained display oneline start=+"+
                                \ end=+"\ze\%([[:blank:]]\|$\)+
                                \ nextgroup=nanorcEndRegion skipwhite

syn keyword nanorcEndRegion     contained end nextgroup=nanorcStartRegionEq

syn match   nanorcEndRegionEq   contained '=' nextgroup=nanorcRegex

syn region  nanorcRegex         contained display oneline start=+"+
                                \ end=+"\ze\%([[:blank:]]\|$\)+

hi def link nanorcTodo          Todo
hi def link nanorcComment       Comment
hi def link nanorcKeyword       Keyword
hi def link nanorcBoolOption    Identifier
hi def link nanorcStringOption  Identifier
hi def link nanorcNumberOption  Identifier
hi def link nanorcSynGroupName  String
hi def link nanorcString        String
hi def link nanorcRegexes       nanorcString
hi def link nanorcNumber        Number
hi def      nanorcFGWhite       ctermfg=Gray guifg=Gray
hi def      nanorcFGBlack       ctermfg=Black guifg=Black
hi def      nanorcFGRed         ctermfg=DarkRed guifg=DarkRed
hi def      nanorcFGBlue        ctermfg=DarkBlue guifg=DarkBlue
hi def      nanorcFGGreen       ctermfg=DarkGreen guifg=DarkGreen
hi def      nanorcFGYellow      ctermfg=Brown guifg=Brown
hi def      nanorcFGMagenta     ctermfg=DarkMagenta guifg=DarkMagenta
hi def      nanorcFGCyan        ctermfg=DarkCyan guifg=DarkCyan
hi def      nanorcFGBWhite      ctermfg=White guifg=White
hi def      nanorcFGBBlack      ctermfg=DarkGray guifg=DarkGray
hi def      nanorcFGBRed        ctermfg=Red guifg=Red
hi def      nanorcFGBBlue       ctermfg=Blue guifg=Blue
hi def      nanorcFGBGreen      ctermfg=Green guifg=Green
hi def      nanorcFGBYellow     ctermfg=Yellow guifg=Yellow
hi def      nanorcFGBMagenta    ctermfg=Magenta guifg=Magenta
hi def      nanorcFGBCyan       ctermfg=Cyan guifg=Cyan
hi def link nanorcBGColorSep    Normal
hi def      nanorcBGWhite       ctermbg=Gray guibg=Gray
hi def      nanorcBGBlack       ctermbg=Black guibg=Black
hi def      nanorcBGRed         ctermbg=DarkRed guibg=DarkRed
hi def      nanorcBGBlue        ctermbg=DarkBlue guibg=DarkBlue
hi def      nanorcBGGreen       ctermbg=DarkGreen guibg=DarkGreen
hi def      nanorcBGYellow      ctermbg=Brown guibg=Brown
hi def      nanorcBGMagenta     ctermbg=DarkMagenta guibg=DarkMagenta
hi def      nanorcBGCyan        ctermbg=DarkCyan guibg=DarkCyan
hi def      nanorcBGBWhite      ctermbg=White guibg=White
hi def      nanorcBGBBlack      ctermbg=DarkGray guibg=DarkGray
hi def      nanorcBGBRed        ctermbg=Red guibg=Red
hi def      nanorcBGBBlue       ctermbg=Blue guibg=Blue
hi def      nanorcBGBGreen      ctermbg=Green guibg=Green
hi def      nanorcBGBYellow     ctermbg=Yellow guibg=Yellow
hi def      nanorcBGBMagenta    ctermbg=Magenta guibg=Magenta
hi def      nanorcBGBCyan       ctermbg=Cyan guibg=Cyan
hi def link nanorcStartRegion   Type
hi def link nanorcStartRegionEq Operator
hi def link nanorcRegion        nanorcString
hi def link nanorcEndRegion     Type
hi def link nanorcEndRegionEq   Operator
hi def link nanorcRegex         nanoRegexes

let b:current_syntax = "nanorc"

let &cpo = s:cpo_save
unlet s:cpo_save