aboutsummaryrefslogtreecommitdiff
path: root/vim/after/syntax
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-11-08 12:53:22 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-11-08 12:53:22 +1300
commit2ba00c6c583cef8f3dcf06a8aa9bec8754b81498 (patch)
treebc53a5564ca42e4d39b35e6916a5c80e05271f3b /vim/after/syntax
parentDisable unwanted shell error syntax for any shell (diff)
downloaddotfiles-2ba00c6c583cef8f3dcf06a8aa9bec8754b81498.tar.gz
dotfiles-2ba00c6c583cef8f3dcf06a8aa9bec8754b81498.zip
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.
Diffstat (limited to 'vim/after/syntax')
-rw-r--r--vim/after/syntax/sh.vim76
1 files changed, 76 insertions, 0 deletions
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')