From 2ba00c6c583cef8f3dcf06a8aa9bec8754b81498 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 8 Nov 2017 12:53:22 +1300 Subject: Override commands and variables for syntax/sh.vim The defaults for these groups don't make much sense to me, so I completely reset them. This isn't quite complete yet; for some reason as soon as e.g. an IFS= setting is contained in e.g. an "if" or "while" block, they don't highlight correctly anymore. There's probably some other part of the core syntax/sh.vim file I need to include here. --- vim/after/syntax/sh.vim | 76 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/vim/after/syntax/sh.vim b/vim/after/syntax/sh.vim index 48a3452d..9692ea9f 100644 --- a/vim/after/syntax/sh.vim +++ b/vim/after/syntax/sh.vim @@ -18,6 +18,82 @@ syntax clear shDerefWordError " probably not worth keeping the error. syntax clear shParenError +" Highlighting corrections specific to POSIX mode +if exists('b:is_posix') + + " Highlight some commands that are both defined by POSIX and builtin + " commands in dash, as a rough but useable proxy for 'shell builtins'. This + " list was wrested from `man 1 dash`. + syntax clear shStatement + syntax keyword shStatement + \ alias + \ bg + \ cd + \ command + \ echo + \ eval + \ exec + \ exit + \ export + \ fc + \ fg + \ getopts + \ hash + \ printf + \ pwd + \ read + \ readonly + \ set + \ shift + \ test + \ times + \ trap + \ true + \ type + \ ulimit + \ umask + \ unalias + \ unset + \ wait + + " Core syntax/sh.vim puts IFS and other variables that affect shell function + " in another color, but a subset of them actually apply to POSIX shell too + " (and plain Bourne). These are selected by searching the POSIX manpages. I + " added NLSPATH too, which wasn't in the original. + syntax clear shShellVariables + syntax keyword shShellVariables + \ CDPATH + \ ENV + \ FCEDIT + \ HISTFILE + \ HISTSIZE + \ HISTTIMEFORMAT + \ HOME + \ IFS + \ LANG + \ LC_ALL + \ LC_COLLATE + \ LC_CTYPE + \ LC_MESSAGES + \ LC_NUMERIC + \ LINENO + \ MAIL + \ MAILCHECK + \ MAILPATH + \ NLSPATH + \ OLDPWD + \ OPTARG + \ OPTERR + \ OPTIND + \ PATH + \ PS1 + \ PS2 + \ PS3 + \ PS4 + \ PWD + +endif + " Some corrections for highlighting specific to the Bash mode if exists('b:is_bash') -- cgit v1.2.3