aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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')