summaryrefslogtreecommitdiff
path: root/runtime/syntax/readline.vim
blob: b50b9c60e5566d28f4b3b23ae53b27bdb3ffdf6e (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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
" Vim syntax file
" Language:             readline(3) configuration file
" Previous Maintainer:  Nikolai Weibull <now@bitwi.se>
" Latest Revision:      2017-06-25
"   readline_has_bash - if defined add support for bash specific
"                       settings/functions

if exists('b:current_syntax')
  finish
endif

let s:cpo_save = &cpo
set cpo&vim

setlocal iskeyword+=-

syn match   readlineKey         contained
                              \ '\S'
                              \ nextgroup=readlineKeyTerminator

syn match   readlineBegin       display '^'
                              \ nextgroup=readlineComment,
                              \           readlineConditional,
                              \           readlineInclude,
                              \           readlineKeyName,
                              \           readlineKey,
                              \           readlineKeySeq,
                              \           readlineKeyword
                              \ skipwhite

syn region  readlineComment     contained display oneline
                                \ start='#'
                                \ end='$'
                                \ contains=readlineTodo,
                                \          @Spell

syn keyword readlineTodo        contained
                              \ TODO
                              \ FIXME
                              \ XXX
                              \ NOTE

syn match   readlineConditional contained
                              \ '$if\>'
                              \ nextgroup=readlineTest,
                              \           readlineTestApp
                              \ skipwhite

syn keyword readlineTest        contained
                              \ mode
                              \ nextgroup=readlineTestModeEq

syn match   readlineTestModeEq  contained
                              \ '='
                              \ nextgroup=readlineEditingMode

syn keyword readlineTest        contained
                              \ term
                              \ nextgroup=readlineTestTermEq

syn match   readlineTestTermEq  contained
                              \ '='
                              \ nextgroup=readlineTestTerm

syn match   readlineTestTerm    contained
                              \ '\S\+'

syn match   readlineTestApp     contained
                              \ '\S\+'

syn match   readlineConditional contained display
                              \ '$\%(else\|endif\)\>'

syn match   readlineInclude     contained display
                              \ '$include\>'
                              \ nextgroup=readlinePath

syn match   readlinePath        contained display
                              \ '.\+'

syn case ignore
syn match   readlineKeyName     contained display
                              \ nextgroup=readlineKeySeparator,
                              \           readlineKeyTerminator
                              \ '\%(Control\|Del\|Esc\|Escape\|LFD\|Meta\|Newline\|Ret\|Return\|Rubout\|Space\|Spc\|Tab\)'
syn case match

syn match   readlineKeySeparator  contained
                                \ '-'
                                \ nextgroup=readlineKeyName,
                                \           readlineKey

syn match   readlineKeyTerminator contained
                                \ ':'
                                \ nextgroup=readlineFunction
                                \ skipwhite

syn region  readlineKeySeq     contained display oneline
                              \ start=+"+
                              \ skip=+\\\\\|\\"+
                              \ end=+"+
                              \ contains=readlineKeyEscape
                              \ nextgroup=readlineKeyTerminator

syn match   readlineKeyEscape   contained display
                              \ +\\\([CM]-\|[e\\"'abdfnrtv]\|\o\{3}\|x\x\{2}\)+

syn keyword readlineKeyword     contained
                              \ set
                              \ nextgroup=readlineVariable
                              \ skipwhite

syn keyword readlineVariable    contained 
                              \ nextgroup=readlineBellStyle
                              \ skipwhite
                              \ bell-style

syn keyword readlineVariable    contained
                              \ nextgroup=readlineBoolean
                              \ skipwhite
                              \ bind-tty-special-chars
                              \ colored-stats
                              \ completion-ignore-case
                              \ completion-map-case
                              \ convert-meta
                              \ disable-completion
                              \ echo-control-characters
                              \ enable-keypad
                              \ enable-meta-key
                              \ expand-tilde
                              \ history-preserve-point
                              \ horizontal-scroll-mode
                              \ input-meta
                              \ meta-flag
                              \ mark-directories
                              \ mark-modified-lines
                              \ mark-symlinked-directories
                              \ match-hidden-files
                              \ menu-complete-display-prefix
                              \ output-meta
                              \ page-completions
                              \ print-completions-horizontally
                              \ revert-all-at-newline
                              \ show-all-if-ambiguous
                              \ show-all-if-unmodified
                              \ show-mode-in-prompt
                              \ skip-completed-text
                              \ visible-stats

syn keyword readlineVariable    contained
                              \ nextgroup=readlineString
                              \ skipwhite
                              \ comment-begin
                              \ isearch-terminators

syn keyword readlineVariable    contained
                              \ nextgroup=readlineNumber
                              \ skipwhite
                              \ completion-display-width
                              \ completion-prefix-display-length
                              \ completion-query-items
                              \ history-size
                              \ keyseq-timeout

syn keyword readlineVariable    contained
                              \ nextgroup=readlineEditingMode
                              \ skipwhite
                              \ editing-mode

syn keyword readlineVariable    contained
                              \ nextgroup=readlineKeymap
                              \ skipwhite
                              \ keymap

syn keyword readlineBellStyle   contained
                              \ audible
                              \ visible
                              \ none

syn case ignore
syn keyword readlineBoolean     contained
                              \ on
                              \ off
syn case match

syn region  readlineString      contained display oneline
                              \ matchgroup=readlineStringDelimiter
                              \ start=+"+
                              \ skip=+\\\\\|\\"+
                              \ end=+"+

syn match   readlineNumber      contained display
                              \ '[+-]\d\+\>'

syn keyword readlineEditingMode contained
                              \ emacs
                              \ vi

syn match   readlineKeymap      contained display
                              \ 'emacs\%(-\%(standard\|meta\|ctlx\)\)\=\|vi\%(-\%(move\|command\|insert\)\)\='

syn keyword readlineFunction    contained
                              \ beginning-of-line
                              \ end-of-line
                              \ forward-char
                              \ backward-char
                              \ forward-word
                              \ backward-word
                              \ clear-screen
                              \ redraw-current-line
                              \
                              \ accept-line
                              \ previous-history
                              \ next-history
                              \ beginning-of-history
                              \ end-of-history
                              \ reverse-search-history
                              \ forward-search-history
                              \ non-incremental-reverse-search-history
                              \ non-incremental-forward-search-history
                              \ history-search-forward
                              \ history-search-backward
                              \ yank-nth-arg
                              \ yank-last-arg
                              \
                              \ delete-char
                              \ backward-delete-char
                              \ forward-backward-delete-char
                              \ quoted-insert
                              \ tab-insert
                              \ self-insert
                              \ transpose-chars
                              \ transpose-words
                              \ upcase-word
                              \ downcase-word
                              \ capitalize-word
                              \ overwrite-mode
                              \
                              \ kill-line
                              \ backward-kill-line
                              \ unix-line-discard
                              \ kill-whole-line
                              \ kill-word
                              \ backward-kill-word
                              \ unix-word-rubout
                              \ unix-filename-rubout
                              \ delete-horizontal-space
                              \ kill-region
                              \ copy-region-as-kill
                              \ copy-backward-word
                              \ copy-forward-word
                              \ yank
                              \ yank-pop
                              \
                              \ digit-argument
                              \ universal-argument
                              \
                              \ complete
                              \ possible-completions
                              \ insert-completions
                              \ menu-complete
                              \ menu-complete-backward
                              \ delete-char-or-list
                              \
                              \ start-kbd-macro
                              \ end-kbd-macro
                              \ call-last-kbd-macro
                              \
                              \ re-read-init-file
                              \ abort
                              \ do-uppercase-version
                              \ prefix-meta
                              \ undo
                              \ revert-line
                              \ tilde-expand
                              \ set-mark
                              \ exchange-point-and-mark
                              \ character-search
                              \ character-search-backward
                              \ skip-csi-sequence
                              \ insert-comment
                              \ dump-functions
                              \ dump-variables
                              \ dump-macros
                              \ emacs-editing-mode
                              \ vi-editing-mode
                              \
                              \ vi-eof-maybe
                              \ vi-movement-mode
                              \ vi-undo
                              \ vi-match
                              \ vi-tilde-expand
                              \ vi-complete
                              \ vi-char-search
                              \ vi-redo
                              \ vi-search
                              \ vi-arg-digit
                              \ vi-append-eol
                              \ vi-prev-word
                              \ vi-change-to
                              \ vi-delete-to
                              \ vi-end-word
                              \ vi-char-search
                              \ vi-fetch-history
                              \ vi-insert-beg
                              \ vi-search-again
                              \ vi-put
                              \ vi-replace
                              \ vi-subst
                              \ vi-char-search
                              \ vi-next-word
                              \ vi-yank-to
                              \ vi-first-print
                              \ vi-yank-arg
                              \ vi-goto-mark
                              \ vi-append-mode
                              \ vi-prev-word
                              \ vi-change-to
                              \ vi-delete-to
                              \ vi-end-word
                              \ vi-char-search
                              \ vi-insert-mode
                              \ vi-set-mark
                              \ vi-search-again
                              \ vi-put
                              \ vi-change-char
                              \ vi-subst
                              \ vi-char-search
                              \ vi-undo
                              \ vi-next-word
                              \ vi-delete
                              \ vi-yank-to
                              \ vi-column
                              \ vi-change-case

if exists("readline_has_bash")
  syn keyword readlineFunction  contained
                              \ shell-expand-line
                              \ history-expand-line
                              \ magic-space
                              \ alias-expand-line
                              \ history-and-alias-expand-line
                              \ insert-last-argument
                              \ operate-and-get-next
                              \ forward-backward-delete-char
                              \ delete-char-or-list
                              \ complete-filename
                              \ possible-filename-completions
                              \ complete-username
                              \ possible-username-completions
                              \ complete-variable
                              \ possible-variable-completions
                              \ complete-hostname
                              \ possible-hostname-completions
                              \ complete-command
                              \ possible-command-completions
                              \ dynamic-complete-history
                              \ complete-into-braces
                              \ glob-expand-word
                              \ glob-list-expansions
                              \ display-shell-version
                              \ glob-complete-word
                              \ edit-and-execute-command
endif

hi def link readlineKey           readlineKeySeq
hi def link readlineComment       Comment
hi def link readlineTodo          Todo
hi def link readlineConditional   Conditional
hi def link readlineTest          Type
hi def link readlineDelimiter     Delimiter
hi def link readlineTestModeEq    readlineEq
hi def link readlineTestTermEq    readlineEq
hi def link readlineTestTerm      readlineString
hi def link readlineTestAppEq     readlineEq
hi def link readlineTestApp       readlineString
hi def link readlineInclude       Include
hi def link readlinePath          String
hi def link readlineKeyName       SpecialChar
hi def link readlineKeySeparator  readlineKeySeq
hi def link readlineKeyTerminator readlineDelimiter
hi def link readlineKeySeq        String
hi def link readlineKeyEscape     SpecialChar
hi def link readlineKeyword       Keyword
hi def link readlineVariable      Identifier
hi def link readlineBellStyle     Constant
hi def link readlineBoolean       Boolean
hi def link readlineString        String
hi def link readlineStringDelimiter readlineString
hi def link readlineNumber        Number
hi def link readlineEditingMode   Constant
hi def link readlineKeymap        Constant
hi def link readlineFunction      Function

let b:current_syntax = 'readline'

let &cpo = s:cpo_save
unlet s:cpo_save