1" Vim syntax file
2" Language:         readline(3) configuration file
3" Maintainer:       Nikolai Weibull <now@bitwi.se>
4" Latest Revision:  2009-05-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 keyword readlineTodo        contained TODO FIXME XXX NOTE
18
19syn region  readlineComment     display oneline start='^\s*#' end='$'
20                                \ contains=readlineTodo,@Spell
21
22syn match   readlineString      '^\s*[A-Za-z-]\+:'me=e-1 contains=readlineKeys
23syn region  readlineString      display oneline start=+"+ skip=+\\\\\|\\"+
24                                \ end=+"+ contains=readlineKeysTwo
25
26syn case ignore
27syn keyword readlineKeys        contained Control Meta Del Esc Escape LFD
28                                \ Newline Ret Return Rubout Space Spc Tab
29syn case match
30
31syn match   readlineKeysTwo     contained display
32                                \ +\\\([CM]-\|[e\\"'abdfnrtv]\|\o\{3}\|x\x\{3}\)+
33
34syn match   readlineKeymaps     contained display
35                                \ 'emacs\(-standard\|-meta\|-ctlx\)\='
36syn match   readlineKeymaps     contained display
37                                \ 'vi\(-move\|-command\|-insert\)\='
38
39syn keyword readlineBellStyles  contained audible visible none
40
41syn match   readlineNumber      contained display '\<\d\+\>'
42
43syn case ignore
44syn keyword readlineBoolean     contained on off
45syn case match
46
47syn keyword readlineIfOps       contained mode term
48
49syn region  readlineConditional display oneline transparent
50                                \ matchgroup=readlineConditional
51                                \ start='^\s*$if' end="$"
52                                \ contains=readlineIfOps,readlineKeymaps
53syn match   readlineConditional display '^\s*$\(else\|endif\)\>'
54
55syn match   readlineInclude     display '^\s*$include\>'
56
57syn region  readlineSet         display oneline transparent
58                                \ matchgroup=readlineKeyword start='^\s*set\>'
59                                \ end="$"me=e-1 contains=readlineNumber,
60                                \ readlineBoolean,readlineKeymaps,
61                                \ readlineBellStyles,readlineSettings
62
63syn keyword readlineSettings    contained bell-style comment-begin
64                                \ completion-ignore-case completion-query-items
65                                \ convert-meta disable-completion editing-mode
66                                \ enable-keypad expand-tilde
67                                \ horizontal-scroll-mode mark-directories
68                                \ keymap mark-modified-lines meta-flag
69                                \ input-meta output-meta
70                                \ print-completions-horizontally
71                                \ show-all-if-ambiguous visible-stats
72                                \ prefer-visible-bell blink-matching-paren
73                                \ match-hidden-files history-preserve-point
74                                \ isearch-terminators
75
76syn region  readlineBinding     display oneline transparent
77                                \ matchgroup=readlineKeyword start=':' end='$'
78                                \ contains=readlineKeys,readlineFunctions
79
80syn keyword readlineFunctions   contained display
81                                \ beginning-of-line end-of-line forward-char
82                                \ backward-char forward-word backward-word
83                                \ clear-screen redraw-current-line
84                                \ accept-line previous-history
85                                \ next-history beginning-of-history
86                                \ end-of-history reverse-search-history
87                                \ forward-search-history
88                                \ non-incremental-reverse-search-history
89                                \ non-incremental-forward-search-history
90                                \ history-search-forward
91                                \ history-search-backward
92                                \ yank-nth-arg yank-last-arg
93                                \ delete-char backward-delete-char
94                                \ forward-backward-delete-char quoted-insert
95                                \ tab-insert self-insert transpose-chars
96                                \ transpose-words upcase-word downcase-word
97                                \ capitalize-word overwrite-mode kill-line
98                                \ backward-kill-line unix-line-discard
99                                \ kill-whole-line kill-word backward-kill-word
100                                \ unix-word-rubout unix-filename-rubout
101                                \ delete-horizontal-space kill-region
102                                \ copy-region-as-kill copy-backward-word
103                                \ copy-forward-word yank yank-pop
104                                \ digit-argument universal-argument complete
105                                \ possible-completions insert-completions
106                                \ menu-complete delete-char-or-list
107                                \ start-kbd-macro end-kbd-macro
108                                \ call-last-kbd-macro re-read-init-file
109                                \ abort do-uppercase-version prefix-meta
110                                \ undo revert-line tilde-expand set-mark
111                                \ exchange-point-and-mark character-search
112                                \ character-search-backward insert-comment
113                                \ dump-functions dump-variables dump-macros
114                                \ emacs-editing-mode vi-editing-mode
115                                \ vi-complete vi-char-search vi-redo
116                                \ vi-search vi-arg-digit vi-append-eol
117                                \ vi-prev-word vi-change-to vi-delete-to
118                                \ vi-end-word vi-fetch-history vi-insert-beg
119                                \ vi-search-again vi-put vi-replace
120                                \ vi-subst vi-yank-to vi-first-print
121                                \ vi-yank-arg vi-goto-mark vi-append-mode
122                                \ vi-insertion-mode prev-history vi-set-mark
123                                \ vi-search-again vi-put vi-change-char
124                                \ vi-subst vi-delete vi-yank-to
125                                \ vi-column vi-change-case vi-overstrike
126                                \ vi-overstrike-delete do-lowercase-version
127                                \ delete-char-or-list tty-status
128                                \ arrow-key-prefix vi-back-to-indent vi-bword
129                                \ vi-bWord vi-eword vi-eWord vi-fword vi-fWord
130                                \ vi-next-word
131                                \ vi-movement-mode
132
133if exists("readline_has_bash")
134  syn keyword readlineFunctions contained
135                                \ shell-expand-line history-expand-line
136                                \ magic-space alias-expand-line
137                                \ history-and-alias-expand-line
138                                \ insert-last-argument operate-and-get-next
139                                \ forward-backward-delete-char
140                                \ delete-char-or-list complete-filename
141                                \ possible-filename-completions
142                                \ complete-username
143                                \ possible-username-completions
144                                \ complete-variable
145                                \ possible-variable-completions
146                                \ complete-hostname
147                                \ possible-hostname-completions
148                                \ complete-command
149                                \ possible-command-completions
150                                \ dynamic-complete-history
151                                \ complete-into-braces
152                                \ glob-expand-word glob-list-expansions
153                                \ display-shell-version glob-complete-word
154                                \ edit-and-execute-command
155endif
156
157hi def link readlineComment     Comment
158hi def link readlineTodo        Todo
159hi def link readlineString      String
160hi def link readlineKeys        SpecialChar
161hi def link readlineKeysTwo     SpecialChar
162hi def link readlineKeymaps     Constant
163hi def link readlineBellStyles  Constant
164hi def link readlineNumber      Number
165hi def link readlineBoolean     Boolean
166hi def link readlineIfOps       Type
167hi def link readlineConditional Conditional
168hi def link readlineInclude     Include
169hi def link readlineKeyword     Keyword
170hi def link readlineSettings    Type
171hi def link readlineFunctions   Type
172
173let b:current_syntax = "readline"
174
175let &cpo = s:cpo_save
176unlet s:cpo_save
177