xref: /vim-8.2.3635/runtime/syntax/readline.vim (revision 8ee2d36e)
1" Vim syntax file
2" Language:             readline(3) configuration file
3" Previous Maintainer:  Nikolai Weibull <[email protected]>
4" Latest Revision:      2017-06-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                              \ colored-stats
123                              \ completion-ignore-case
124                              \ completion-map-case
125                              \ convert-meta
126                              \ disable-completion
127                              \ echo-control-characters
128                              \ enable-keypad
129                              \ enable-meta-key
130                              \ expand-tilde
131                              \ history-preserve-point
132                              \ horizontal-scroll-mode
133                              \ input-meta
134                              \ meta-flag
135                              \ mark-directories
136                              \ mark-modified-lines
137                              \ mark-symlinked-directories
138                              \ match-hidden-files
139                              \ menu-complete-display-prefix
140                              \ output-meta
141                              \ page-completions
142                              \ print-completions-horizontally
143                              \ revert-all-at-newline
144                              \ show-all-if-ambiguous
145                              \ show-all-if-unmodified
146                              \ show-mode-in-prompt
147                              \ skip-completed-text
148                              \ visible-stats
149
150syn keyword readlineVariable    contained
151                              \ nextgroup=readlineString
152                              \ skipwhite
153                              \ comment-begin
154                              \ isearch-terminators
155
156syn keyword readlineVariable    contained
157                              \ nextgroup=readlineNumber
158                              \ skipwhite
159                              \ completion-display-width
160                              \ completion-prefix-display-length
161                              \ completion-query-items
162                              \ history-size
163                              \ keyseq-timeout
164
165syn keyword readlineVariable    contained
166                              \ nextgroup=readlineEditingMode
167                              \ skipwhite
168                              \ editing-mode
169
170syn keyword readlineVariable    contained
171                              \ nextgroup=readlineKeymap
172                              \ skipwhite
173                              \ keymap
174
175syn keyword readlineBellStyle   contained
176                              \ audible
177                              \ visible
178                              \ none
179
180syn case ignore
181syn keyword readlineBoolean     contained
182                              \ on
183                              \ off
184syn case match
185
186syn region  readlineString      contained display oneline
187                              \ matchgroup=readlineStringDelimiter
188                              \ start=+"+
189                              \ skip=+\\\\\|\\"+
190                              \ end=+"+
191
192syn match   readlineNumber      contained display
193                              \ '[+-]\d\+\>'
194
195syn keyword readlineEditingMode contained
196                              \ emacs
197                              \ vi
198
199syn match   readlineKeymap      contained display
200                              \ 'emacs\%(-\%(standard\|meta\|ctlx\)\)\=\|vi\%(-\%(move\|command\|insert\)\)\='
201
202syn keyword readlineFunction    contained
203                              \ beginning-of-line
204                              \ end-of-line
205                              \ forward-char
206                              \ backward-char
207                              \ forward-word
208                              \ backward-word
209                              \ clear-screen
210                              \ redraw-current-line
211                              \
212                              \ accept-line
213                              \ previous-history
214                              \ next-history
215                              \ beginning-of-history
216                              \ end-of-history
217                              \ reverse-search-history
218                              \ forward-search-history
219                              \ non-incremental-reverse-search-history
220                              \ non-incremental-forward-search-history
221                              \ history-search-forward
222                              \ history-search-backward
223                              \ yank-nth-arg
224                              \ yank-last-arg
225                              \
226                              \ delete-char
227                              \ backward-delete-char
228                              \ forward-backward-delete-char
229                              \ quoted-insert
230                              \ tab-insert
231                              \ self-insert
232                              \ transpose-chars
233                              \ transpose-words
234                              \ upcase-word
235                              \ downcase-word
236                              \ capitalize-word
237                              \ overwrite-mode
238                              \
239                              \ kill-line
240                              \ backward-kill-line
241                              \ unix-line-discard
242                              \ kill-whole-line
243                              \ kill-word
244                              \ backward-kill-word
245                              \ unix-word-rubout
246                              \ unix-filename-rubout
247                              \ delete-horizontal-space
248                              \ kill-region
249                              \ copy-region-as-kill
250                              \ copy-backward-word
251                              \ copy-forward-word
252                              \ yank
253                              \ yank-pop
254                              \
255                              \ digit-argument
256                              \ universal-argument
257                              \
258                              \ complete
259                              \ possible-completions
260                              \ insert-completions
261                              \ menu-complete
262                              \ menu-complete-backward
263                              \ delete-char-or-list
264                              \
265                              \ start-kbd-macro
266                              \ end-kbd-macro
267                              \ call-last-kbd-macro
268                              \
269                              \ re-read-init-file
270                              \ abort
271                              \ do-uppercase-version
272                              \ prefix-meta
273                              \ undo
274                              \ revert-line
275                              \ tilde-expand
276                              \ set-mark
277                              \ exchange-point-and-mark
278                              \ character-search
279                              \ character-search-backward
280                              \ skip-csi-sequence
281                              \ insert-comment
282                              \ dump-functions
283                              \ dump-variables
284                              \ dump-macros
285                              \ emacs-editing-mode
286                              \ vi-editing-mode
287                              \
288                              \ vi-eof-maybe
289                              \ vi-movement-mode
290                              \ vi-undo
291                              \ vi-match
292                              \ vi-tilde-expand
293                              \ vi-complete
294                              \ vi-char-search
295                              \ vi-redo
296                              \ vi-search
297                              \ vi-arg-digit
298                              \ vi-append-eol
299                              \ vi-prev-word
300                              \ vi-change-to
301                              \ vi-delete-to
302                              \ vi-end-word
303                              \ vi-char-search
304                              \ vi-fetch-history
305                              \ vi-insert-beg
306                              \ vi-search-again
307                              \ vi-put
308                              \ vi-replace
309                              \ vi-subst
310                              \ vi-char-search
311                              \ vi-next-word
312                              \ vi-yank-to
313                              \ vi-first-print
314                              \ vi-yank-arg
315                              \ vi-goto-mark
316                              \ vi-append-mode
317                              \ vi-prev-word
318                              \ vi-change-to
319                              \ vi-delete-to
320                              \ vi-end-word
321                              \ vi-char-search
322                              \ vi-insert-mode
323                              \ vi-set-mark
324                              \ vi-search-again
325                              \ vi-put
326                              \ vi-change-char
327                              \ vi-subst
328                              \ vi-char-search
329                              \ vi-undo
330                              \ vi-next-word
331                              \ vi-delete
332                              \ vi-yank-to
333                              \ vi-column
334                              \ vi-change-case
335
336if exists("readline_has_bash")
337  syn keyword readlineFunction  contained
338                              \ shell-expand-line
339                              \ history-expand-line
340                              \ magic-space
341                              \ alias-expand-line
342                              \ history-and-alias-expand-line
343                              \ insert-last-argument
344                              \ operate-and-get-next
345                              \ forward-backward-delete-char
346                              \ delete-char-or-list
347                              \ complete-filename
348                              \ possible-filename-completions
349                              \ complete-username
350                              \ possible-username-completions
351                              \ complete-variable
352                              \ possible-variable-completions
353                              \ complete-hostname
354                              \ possible-hostname-completions
355                              \ complete-command
356                              \ possible-command-completions
357                              \ dynamic-complete-history
358                              \ complete-into-braces
359                              \ glob-expand-word
360                              \ glob-list-expansions
361                              \ display-shell-version
362                              \ glob-complete-word
363                              \ edit-and-execute-command
364endif
365
366hi def link readlineKey           readlineKeySeq
367hi def link readlineComment       Comment
368hi def link readlineTodo          Todo
369hi def link readlineConditional   Conditional
370hi def link readlineTest          Type
371hi def link readlineDelimiter     Delimiter
372hi def link readlineTestModeEq    readlineEq
373hi def link readlineTestTermEq    readlineEq
374hi def link readlineTestTerm      readlineString
375hi def link readlineTestAppEq     readlineEq
376hi def link readlineTestApp       readlineString
377hi def link readlineInclude       Include
378hi def link readlinePath          String
379hi def link readlineKeyName       SpecialChar
380hi def link readlineKeySeparator  readlineKeySeq
381hi def link readlineKeyTerminator readlineDelimiter
382hi def link readlineKeySeq        String
383hi def link readlineKeyEscape     SpecialChar
384hi def link readlineKeyword       Keyword
385hi def link readlineVariable      Identifier
386hi def link readlineBellStyle     Constant
387hi def link readlineBoolean       Boolean
388hi def link readlineString        String
389hi def link readlineStringDelimiter readlineString
390hi def link readlineNumber        Number
391hi def link readlineEditingMode   Constant
392hi def link readlineKeymap        Constant
393hi def link readlineFunction      Function
394
395let b:current_syntax = 'readline'
396
397let &cpo = s:cpo_save
398unlet s:cpo_save
399