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