xref: /vim-8.2.3635/runtime/syntax/readline.vim (revision cb03397a)
1" Vim syntax file
2" Language:         readline(3) configuration file
3" Maintainer:       Nikolai Weibull <[email protected]>
4" Latest Revision:  2012-04-25
5"   readline_has_bash - if defined add support for bash specific
6"                       settings/functions
7
8if exists('b:current_syntax')
9  finish
10endif
11
12let s:cpo_save = &cpo
13set cpo&vim
14
15setlocal iskeyword+=-
16
17syn match   readlineKey         contained
18                              \ '\S'
19                              \ nextgroup=readlineKeyTerminator
20
21syn match   readlineBegin       display '^'
22                              \ nextgroup=readlineComment,
23                              \           readlineConditional,
24                              \           readlineInclude,
25                              \           readlineKeyName,
26                              \           readlineKey,
27                              \           readlineKeySeq,
28                              \           readlineKeyword
29                              \ skipwhite
30
31syn region  readlineComment     contained display oneline
32                                \ start='#'
33                                \ end='$'
34                                \ contains=readlineTodo,
35                                \          @Spell
36
37syn keyword readlineTodo        contained
38                              \ TODO
39                              \ FIXME
40                              \ XXX
41                              \ NOTE
42
43syn match   readlineConditional contained
44                              \ '$if\>'
45                              \ nextgroup=readlineTest,
46                              \           readlineTestApp
47                              \ skipwhite
48
49syn keyword readlineTest        contained
50                              \ mode
51                              \ nextgroup=readlineTestModeEq
52
53syn match   readlineTestModeEq  contained
54                              \ '='
55                              \ nextgroup=readlineEditingMode
56
57syn keyword readlineTest        contained
58                              \ term
59                              \ nextgroup=readlineTestTermEq
60
61syn match   readlineTestTermEq  contained
62                              \ '='
63                              \ nextgroup=readlineTestTerm
64
65syn match   readlineTestTerm    contained
66                              \ '\S\+'
67
68syn match   readlineTestApp     contained
69                              \ '\S\+'
70
71syn match   readlineConditional contained display
72                              \ '$\%(else\|endif\)\>'
73
74syn match   readlineInclude     contained display
75                              \ '$include\>'
76                              \ nextgroup=readlinePath
77
78syn match   readlinePath        contained display
79                              \ '.\+'
80
81syn case ignore
82syn match   readlineKeyName     contained display
83                              \ nextgroup=readlineKeySeparator,
84                              \           readlineKeyTerminator
85                              \ '\%(Control\|Del\|Esc\|Escape\|LFD\|Meta\|Newline\|Ret\|Return\|Rubout\|Space\|Spc\|Tab\)'
86syn case match
87
88syn match   readlineKeySeparator  contained
89                                \ '-'
90                                \ nextgroup=readlineKeyName,
91                                \           readlineKey
92
93syn match   readlineKeyTerminator contained
94                                \ ':'
95                                \ nextgroup=readlineFunction
96                                \ skipwhite
97
98syn region  readlineKeySeq     contained display oneline
99                              \ start=+"+
100                              \ skip=+\\\\\|\\"+
101                              \ end=+"+
102                              \ contains=readlineKeyEscape
103                              \ nextgroup=readlineKeyTerminator
104
105syn match   readlineKeyEscape   contained display
106                              \ +\\\([CM]-\|[e\\"'abdfnrtv]\|\o\{3}\|x\x\{2}\)+
107
108syn keyword readlineKeyword     contained
109                              \ set
110                              \ nextgroup=readlineVariable
111                              \ skipwhite
112
113syn keyword readlineVariable    contained
114                              \ nextgroup=readlineBellStyle
115                              \ skipwhite
116                              \ bell-style
117
118syn keyword readlineVariable    contained
119                              \ nextgroup=readlineBoolean
120                              \ skipwhite
121                              \ bind-tty-special-chars
122                              \ completion-ignore-case
123                              \ completion-map-case
124                              \ convert-meta
125                              \ disable-completion
126                              \ echo-control-characters
127                              \ enable-keypad
128                              \ enable-meta-key
129                              \ expand-tilde
130                              \ history-preserve-point
131                              \ horizontal-scroll-mode
132                              \ input-meta
133                              \ meta-flag
134                              \ mark-directories
135                              \ mark-modified-lines
136                              \ mark-symlinked-directories
137                              \ match-hidden-files
138                              \ menu-complete-display-prefix
139                              \ output-meta
140                              \ page-completions
141                              \ print-completions-horizontally
142                              \ revert-all-at-newline
143                              \ show-all-if-ambiguous
144                              \ show-all-if-unmodified
145                              \ skip-completed-text
146                              \ visible-stats
147
148syn keyword readlineVariable    contained
149                              \ nextgroup=readlineString
150                              \ skipwhite
151                              \ comment-begin
152                              \ isearch-terminators
153
154syn keyword readlineVariable    contained
155                              \ nextgroup=readlineNumber
156                              \ skipwhite
157                              \ completion-display-width
158                              \ completion-prefix-display-length
159                              \ completion-query-items
160                              \ history-size
161
162syn keyword readlineVariable    contained
163                              \ nextgroup=readlineEditingMode
164                              \ skipwhite
165                              \ editing-mode
166
167syn keyword readlineVariable    contained
168                              \ nextgroup=readlineKeymap
169                              \ skipwhite
170                              \ keymap
171
172syn keyword readlineBellStyle   contained
173                              \ audible
174                              \ visible
175                              \ none
176
177syn case ignore
178syn keyword readlineBoolean     contained
179                              \ on
180                              \ off
181syn case match
182
183syn region  readlineString      contained display oneline
184                              \ matchgroup=readlineStringDelimiter
185                              \ start=+"+
186                              \ skip=+\\\\\|\\"+
187                              \ end=+"+
188
189syn match   readlineNumber      contained display
190                              \ '[+-]\d\+\>'
191
192syn keyword readlineEditingMode contained
193                              \ emacs
194                              \ vi
195
196syn match   readlineKeymap      contained display
197                              \ 'emacs\%(-\%(standard\|meta\|ctlx\)\)\=\|vi\%(-\%(move\|command\|insert\)\)\='
198
199syn keyword readlineFunction    contained
200                              \ beginning-of-line
201                              \ end-of-line
202                              \ forward-char
203                              \ backward-char
204                              \ forward-word
205                              \ backward-word
206                              \ clear-screen
207                              \ redraw-current-line
208                              \
209                              \ accept-line
210                              \ previous-history
211                              \ next-history
212                              \ beginning-of-history
213                              \ end-of-history
214                              \ reverse-search-history
215                              \ forward-search-history
216                              \ non-incremental-reverse-search-history
217                              \ non-incremental-forward-search-history
218                              \ history-search-forward
219                              \ history-search-backward
220                              \ yank-nth-arg
221                              \ yank-last-arg
222                              \
223                              \ delete-char
224                              \ backward-delete-char
225                              \ forward-backward-delete-char
226                              \ quoted-insert
227                              \ tab-insert
228                              \ self-insert
229                              \ transpose-chars
230                              \ transpose-words
231                              \ upcase-word
232                              \ downcase-word
233                              \ capitalize-word
234                              \ overwrite-mode
235                              \
236                              \ kill-line
237                              \ backward-kill-line
238                              \ unix-line-discard
239                              \ kill-whole-line
240                              \ kill-word
241                              \ backward-kill-word
242                              \ unix-word-rubout
243                              \ unix-filename-rubout
244                              \ delete-horizontal-space
245                              \ kill-region
246                              \ copy-region-as-kill
247                              \ copy-backward-word
248                              \ copy-forward-word
249                              \ yank
250                              \ yank-pop
251                              \
252                              \ digit-argument
253                              \ universal-argument
254                              \
255                              \ complete
256                              \ possible-completions
257                              \ insert-completions
258                              \ menu-complete
259                              \ menu-complete-backward
260                              \ delete-char-or-list
261                              \
262                              \ start-kbd-macro
263                              \ end-kbd-macro
264                              \ call-last-kbd-macro
265                              \
266                              \ re-read-init-file
267                              \ abort
268                              \ do-uppercase-version
269                              \ prefix-meta
270                              \ undo
271                              \ revert-line
272                              \ tilde-expand
273                              \ set-mark
274                              \ exchange-point-and-mark
275                              \ character-search
276                              \ character-search-backward
277                              \ skip-csi-sequence
278                              \ insert-comment
279                              \ dump-functions
280                              \ dump-variables
281                              \ dump-macros
282                              \ emacs-editing-mode
283                              \ vi-editing-mode
284                              \
285                              \ vi-eof-maybe
286                              \ vi-movement-mode
287                              \ vi-undo
288                              \ vi-match
289                              \ vi-tilde-expand
290                              \ vi-complete
291                              \ vi-char-search
292                              \ vi-redo
293                              \ vi-search
294                              \ vi-arg-digit
295                              \ vi-append-eol
296                              \ vi-prev-word
297                              \ vi-change-to
298                              \ vi-delete-to
299                              \ vi-end-word
300                              \ vi-char-search
301                              \ vi-fetch-history
302                              \ vi-insert-beg
303                              \ vi-search-again
304                              \ vi-put
305                              \ vi-replace
306                              \ vi-subst
307                              \ vi-char-search
308                              \ vi-next-word
309                              \ vi-yank-to
310                              \ vi-first-print
311                              \ vi-yank-arg
312                              \ vi-goto-mark
313                              \ vi-append-mode
314                              \ vi-prev-word
315                              \ vi-change-to
316                              \ vi-delete-to
317                              \ vi-end-word
318                              \ vi-char-search
319                              \ vi-insert-mode
320                              \ vi-set-mark
321                              \ vi-search-again
322                              \ vi-put
323                              \ vi-change-char
324                              \ vi-subst
325                              \ vi-char-search
326                              \ vi-undo
327                              \ vi-next-word
328                              \ vi-delete
329                              \ vi-yank-to
330                              \ vi-column
331                              \ vi-change-case
332
333if exists("readline_has_bash")
334  syn keyword readlineFunction  contained
335                              \ shell-expand-line
336                              \ history-expand-line
337                              \ magic-space
338                              \ alias-expand-line
339                              \ history-and-alias-expand-line
340                              \ insert-last-argument
341                              \ operate-and-get-next
342                              \ forward-backward-delete-char
343                              \ delete-char-or-list
344                              \ complete-filename
345                              \ possible-filename-completions
346                              \ complete-username
347                              \ possible-username-completions
348                              \ complete-variable
349                              \ possible-variable-completions
350                              \ complete-hostname
351                              \ possible-hostname-completions
352                              \ complete-command
353                              \ possible-command-completions
354                              \ dynamic-complete-history
355                              \ complete-into-braces
356                              \ glob-expand-word
357                              \ glob-list-expansions
358                              \ display-shell-version
359                              \ glob-complete-word
360                              \ edit-and-execute-command
361endif
362
363hi def link readlineKey           readlineKeySeq
364hi def link readlineComment       Comment
365hi def link readlineTodo          Todo
366hi def link readlineConditional   Conditional
367hi def link readlineTest          Type
368hi def link readlineDelimiter     Delimiter
369hi def link readlineTestModeEq    readlineEq
370hi def link readlineTestTermEq    readlineEq
371hi def link readlineTestTerm      readlineString
372hi def link readlineTestAppEq     readlineEq
373hi def link readlineTestApp       readlineString
374hi def link readlineInclude       Include
375hi def link readlinePath          String
376hi def link readlineKeyName       SpecialChar
377hi def link readlineKeySeparator  readlineKeySeq
378hi def link readlineKeyTerminator readlineDelimiter
379hi def link readlineKeySeq        String
380hi def link readlineKeyEscape     SpecialChar
381hi def link readlineKeyword       Keyword
382hi def link readlineVariable      Identifier
383hi def link readlineBellStyle     Constant
384hi def link readlineBoolean       Boolean
385hi def link readlineString        String
386hi def link readlineStringDelimiter readlineString
387hi def link readlineNumber        Number
388hi def link readlineEditingMode   Constant
389hi def link readlineKeymap        Constant
390hi def link readlineFunction      Function
391
392let b:current_syntax = 'readline'
393
394let &cpo = s:cpo_save
395unlet s:cpo_save
396