aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-11-09 10:34:25 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-11-09 10:34:25 +1300
commitb7139c718f09f011f55db8eebbcd329b621386a8 (patch)
treec46c38ca99e16b54404ebb99f877b5d07f7c7a76
parentc7f7f67e2fb727cdaaf941436d00b747bab5922c (diff)
parent0af31dd82d9bfd67cb192c5025b1ed95dbe744f6 (diff)
downloaddotfiles-b7139c718f09f011f55db8eebbcd329b621386a8.tar.gz
dotfiles-b7139c718f09f011f55db8eebbcd329b621386a8.zip
Merge branch 'feature/vim-sh-syn' into develop
* feature/vim-sh-syn: Remove false error flagging for sh char class glob Fix 'while'/'until' highlighting in syntax/sh.vim
-rw-r--r--vim/after/syntax/sh.vim19
1 files changed, 19 insertions, 0 deletions
diff --git a/vim/after/syntax/sh.vim b/vim/after/syntax/sh.vim
index ba209e99..8025c567 100644
--- a/vim/after/syntax/sh.vim
+++ b/vim/after/syntax/sh.vim
@@ -18,6 +18,11 @@ syntax clear shDerefWordError
" probably not worth keeping the error.
syntax clear shParenError
+" The syntax highlighter flags this code with an error on the final square
+" bracket: `case $foo in [![:ascii:]]) ;; esac`, but that's all legal. I'm not
+" yet sure how to fix it, so will just turn the error group for now.
+syntax clear shTestError
+
" Highlighting corrections specific to POSIX mode
if exists('b:is_posix')
@@ -100,6 +105,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