Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: readline configuration file |
| 3 | " Maintainer: Nikolai Weibull <source@pcppopper.org> |
| 4 | " URL: http://www.pcppopper.org/vim/syntax/pcp/readline/ |
| 5 | " Latest Revision: 2004-05-22 |
| 6 | " arch-tag: 6d8e7da4-b39c-4bf7-8e6a-d9135f993457 |
| 7 | " Variables: |
| 8 | " readline_has_bash - if defined add support for bash specific |
| 9 | " settings/functions |
| 10 | |
| 11 | if version < 600 |
| 12 | syntax clear |
| 13 | elseif exists("b:current_syntax") |
| 14 | finish |
| 15 | endif |
| 16 | |
| 17 | " Set iskeyword since we need `-' (and potentially others) in keywords. |
| 18 | " For version 5.x: Set it globally |
| 19 | " For version 6.x: Set it locally |
| 20 | if version >= 600 |
| 21 | command -nargs=1 SetIsk setlocal iskeyword=<args> |
| 22 | else |
| 23 | command -nargs=1 SetIsk set iskeyword=<args> |
| 24 | endif |
| 25 | SetIsk 48-57,65-90,97-122,- |
| 26 | delcommand SetIsk |
| 27 | |
| 28 | " comments |
| 29 | syn region readlineComment display oneline matchgroup=readlineComment start="^\s*#" end="$" contains=readlineTodo |
| 30 | |
| 31 | " todo |
| 32 | syn keyword readlineTodo contained TODO FIXME XXX NOTE |
| 33 | |
| 34 | " strings (argh...not the way i want it, but fine..." |
| 35 | syn match readlineString "^\s*[A-Za-z-]\+:"me=e-1 contains=readlineKeys |
| 36 | syn region readlineString display oneline start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=readlineKeysTwo |
| 37 | |
| 38 | " special key |
| 39 | syn case ignore |
| 40 | syn keyword readlineKeys contained Control Meta Del Esc Escape LFD Newline Ret Return Rubout Space Spc Tab |
| 41 | syn case match |
| 42 | |
| 43 | syn match readlineKeysTwo contained +\\\([CM]-\|[e\\"'abdfnrtv]\|\o\{3}\|x\x\{3}\)+ |
| 44 | |
| 45 | " keymaps |
| 46 | syn match readlineKeymaps contained "emacs\(-standard\|-meta\|-ctlx\)\=" |
| 47 | syn match readlineKeymaps contained "vi\(-move\|-command\|-insert\)\=" |
| 48 | |
| 49 | " bell styles |
| 50 | syn keyword readlineBellStyles contained audible visible none |
| 51 | |
| 52 | " numbers |
| 53 | syn match readlineNumber contained "\<\d\+\>" |
| 54 | |
| 55 | " booleans |
| 56 | syn case ignore |
| 57 | syn keyword readlineBoolean contained on off |
| 58 | syn case match |
| 59 | |
| 60 | " conditionals |
| 61 | syn keyword readlineIfOps contained mode term |
| 62 | |
| 63 | syn region readlineConditional display oneline transparent matchgroup=readlineConditional start="^\s*$if" end="$" contains=readlineIfOps,readlineKeymaps |
| 64 | syn match readlineConditional "^\s*$\(else\|endif\)\>" |
| 65 | |
| 66 | " include |
| 67 | syn match readlineInclude "^\s*$include\>" |
| 68 | |
| 69 | " settings |
| 70 | |
| 71 | syn region readlineSet display oneline transparent matchgroup=readlineKeyword start="^\s*set\>" end="$"me=e-1 contains=readlineNumber,readlineBoolean,readlineKeymaps,readlineBellStyles,readlineSettings |
| 72 | |
| 73 | syn keyword readlineSettings contained bell-style comment-begin completion-ignore-case |
| 74 | syn keyword readlineSettings contained completion-query-items convert-meta disable-completion editing-mode enable-keypad |
| 75 | syn keyword readlineSettings contained expand-tilde horizontal-scroll-mode mark-directories keymap mark-modified-lines meta-flag |
| 76 | syn keyword readlineSettings contained input-meta output-meta print-completions-horizontally show-all-if-ambiguous visible-stats |
| 77 | syn keyword readlineSettings contained prefer-visible-bell blink-matching-paren |
| 78 | syn keyword readlineSettings contained match-hidden-files history-preserve-point isearch-terminators |
| 79 | |
| 80 | " bash extensions |
| 81 | if exists("readline_has_bash") |
| 82 | "syn keyword readlineSettings contained |
| 83 | endif |
| 84 | |
| 85 | " key bindings |
| 86 | syn region readlineBinding display oneline transparent matchgroup=readlineKeyword start=":" end="$" contains=readlineKeys,readlineFunctions |
| 87 | |
| 88 | syn match readlineFunctions contained "\<\(beginning\|end\)-of-line\>" |
| 89 | syn match readlineFunctions contained "\<\(backward\|forward\)-\(char\|word\)\>" |
| 90 | syn match readlineFunctions contained "\<\(previous\|next\|\(beginning\|end\)-of\|\(non-incremental-\)\=\(reverse\|forward\)-search\)-history\>" |
| 91 | syn match readlineFunctions contained "\<history-search-\(forward\|backward\)\>" |
| 92 | syn match readlineFunctions contained "\<yank-\(nth\|last\)-arg\>" |
| 93 | syn match readlineFunctions contained "\<\(backward-\)\=kill-\(\(whole-\)\=line\|word\)\>" |
| 94 | syn match readlineFunctions contained "\<\(start\|end\|call-last\)-kbd-macro\>" |
| 95 | syn match readlineFunctions contained "\<dump-\(functions\|variables\|macros\)\>" |
| 96 | syn match readlineFunctions contained "\<non-incremental-\(reverse\|forward\)-search-history-again\>" |
| 97 | syn keyword readlineFunctions contained clear-screen redraw-current-line accept-line delete-char backward-delete-char quoted-insert tab-insert |
| 98 | syn keyword readlineFunctions contained self-insert transpose-chars transpose-words downcase-word capitalize-word unix-word-rubout |
| 99 | syn keyword readlineFunctions contained delete-horizontal-space kill-region copy-region-as-kill copy-backward-word copy-forward-word yank yank-pop |
| 100 | syn keyword readlineFunctions contained digit-argument universal-argument complete possible-completions insert-completions menu-complete |
| 101 | syn keyword readlineFunctions contained re-read-init-file abort do-uppercase-version prefix-meta undo revert-line tilde-expand set-mark |
| 102 | syn keyword readlineFunctions contained exchange-point-and-mark character-search character-search-backward insert-comment emacs-editing-mode vi-editing-mode |
| 103 | syn keyword readlineFunctions contained unix-line-discard upcase-word backward-delete-word vi-eof-maybe vi-movement-mode vi-match vi-tilde-expand |
| 104 | syn keyword readlineFunctions contained vi-complete vi-char-search vi-redo vi-search vi-arg-digit vi-append-eol vi-prev-word vi-change-to vi-delete-to |
| 105 | syn keyword readlineFunctions contained vi-end-word vi-fetch-history vi-insert-beg vi-search-again vi-put vi-replace vi-subst vi-yank-to vi-first-print |
| 106 | syn keyword readlineFunctions contained vi-yank-arg vi-goto-mark vi-append-mode vi-insertion-mode prev-history vi-set-mark vi-search-again vi-put vi-change-char |
| 107 | syn keyword readlineFunctions contained vi-subst vi-delete vi-yank-to vi-column vi-change-case vi-overstrike vi-overstrike-delete |
| 108 | syn keyword readlineFunctions contained do-lowercase-version delete-char-or-list tty-status arrow-key-prefix |
| 109 | syn keyword readlineFunctions contained vi-back-to-indent vi-bword vi-bWord vi-eword vi-eWord vi-fword vi-fWord vi-next-word |
| 110 | |
| 111 | " bash extensions |
| 112 | if exists("readline_has_bash") |
| 113 | syn keyword readlineFunctions contained shell-expand-line history-expand-line magic-space alias-expand-line history-and-alias-expand-line insert-last-argument |
| 114 | syn keyword readlineFunctions contained operate-and-get-next forward-backward-delete-char delete-char-or-list complete-filename possible-filename-completions |
| 115 | syn keyword readlineFunctions contained complete-username possible-username-completions complete-variable possible-variable-completions complete-hostname |
| 116 | syn keyword readlineFunctions contained possible-hostname-completions complete-command possible-command-completions dynamic-complete-history complete-into-braces |
| 117 | syn keyword readlineFunctions contained glob-expand-word glob-list-expansions display-shell-version |
| 118 | syn keyword readlineFunctions contained glob-complete-word edit-and-execute-command |
| 119 | endif |
| 120 | |
| 121 | " Define the default highlighting. |
| 122 | " For version 5.7 and earlier: only when not done already |
| 123 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 124 | if version >= 508 || !exists("did_readline_syn_inits") |
| 125 | if version < 508 |
| 126 | let did_readline_syn_inits = 1 |
| 127 | command -nargs=+ HiLink hi link <args> |
| 128 | else |
| 129 | command -nargs=+ HiLink hi def link <args> |
| 130 | endif |
| 131 | |
| 132 | HiLink readlineComment Comment |
| 133 | HiLink readlineTodo Todo |
| 134 | HiLink readlineString String |
| 135 | HiLink readlineKeys SpecialChar |
| 136 | HiLink readlineKeysTwo SpecialChar |
| 137 | HiLink readlineKeymaps Constant |
| 138 | HiLink readlineBellStyles Constant |
| 139 | HiLink readlineNumber Number |
| 140 | HiLink readlineBoolean Boolean |
| 141 | HiLink readlineIfOps Type |
| 142 | HiLink readlineConditional Conditional |
| 143 | HiLink readlineInclude Include |
| 144 | HiLink readlineKeyword Keyword |
| 145 | HiLink readlineSettings Type |
| 146 | HiLink readlineFunctions Type |
| 147 | delcommand HiLink |
| 148 | endif |
| 149 | |
| 150 | let b:current_syntax = "readline" |
| 151 | |
| 152 | " vim: set sts=2 sw=2: |