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