diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-11-09 09:33:13 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-11-09 09:44:28 +1300 |
commit | fef27f00690ab0860e24eba0637e57d0cbd44812 (patch) | |
tree | c5bbbeed1e5399990e11e823d9948c4544cf3516 /vim/after/syntax/sh.vim | |
parent | Merge branch 'hotfix/v0.12.2' into develop (diff) | |
download | dotfiles-fef27f00690ab0860e24eba0637e57d0cbd44812.tar.gz dotfiles-fef27f00690ab0860e24eba0637e57d0cbd44812.zip |
Fix 'while'/'until' highlighting in syntax/sh.vim
These two changes coax syntax/sh.vim into realising that POSIX shell
does not specify 'until' as a builtin (that's a Bash/Ksh thing), and
that POSIX shell is able to nest 'while' loops within other blocks
(that's not a Bash/Ksh thing).
Diffstat (limited to 'vim/after/syntax/sh.vim')
-rw-r--r-- | vim/after/syntax/sh.vim | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vim/after/syntax/sh.vim b/vim/after/syntax/sh.vim index ba209e99..98b582bd 100644 --- a/vim/after/syntax/sh.vim +++ b/vim/after/syntax/sh.vim @@ -100,6 +100,20 @@ if exists('b:is_posix') \ PS4 \ PWD + " Core syntax/sh.vim thinks 'until' is a POSIX control structure keyword, + " but it isn't. Reset shRepeat and rebuild it with just 'while'. I only + " sort-of understand what this does, but it works. + syntax clear shRepeat + syntax region shRepeat + \ matchgroup=shLoop + \ start="\<while\_s" end="\<do\>"me=e-2 + \ contains=@shLoopList + + " Run some clustering that core syntax/sh.vim thinks doesn't apply to POSIX; + " this fixes while loops so they can be within other blocks. + syntax cluster shCaseList add=shRepeat + syntax cluster shFunctionList add=shRepeat + endif " Some corrections for highlighting specific to the Bash mode |