From e36efd4f542a24fadf689b82418f94f57dd01f1e Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 30 Oct 2017 15:54:40 +1300 Subject: Rearrange and better explain ksh syntax workaround Move the rule setting the custom b:is_ksh variable used for this workaround (established in 52615f6) into an ftplugin file, rather than into ftdetect; the latter seems a much more appropriate place since by this point we've definitely decided the file type is "sh". From the revised comment in this changeset: >Setting g:is_posix above also prompts Vim's core syntax/sh.vim script >to set g:is_kornshell and thereby b:is_kornshell to the same value as >g:is_posix. > >That's very confusing, so before it happens we'll copy b:is_kornshell's >value as determined by filetype.vim and ~/.vim/ftdetect/sh.vim into a >custom variable b:is_ksh, before its meaning gets confused. > >b:is_ksh as a name is more inline with b:is_bash and b:is_sh, anyway, >so we'll just treat b:is_kornshell like it's both misnamed and broken. > >We can then switch on our custom variable in ~/.vim/after/syntax/sh.vim >to apply settings that actually *are* unique to Korn shell and its >derivatives. --- vim/after/syntax/sh.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'vim/after/syntax') diff --git a/vim/after/syntax/sh.vim b/vim/after/syntax/sh.vim index b9a1a66f..9da1095d 100644 --- a/vim/after/syntax/sh.vim +++ b/vim/after/syntax/sh.vim @@ -1,8 +1,9 @@ " If g:is_posix is set, g:is_kornshell is probably set too, a strange decision " by sh.vim. No matter; we can tease out whether this is actually a Korn shell -" script using our own b:is_ksh flag set at the end of ~/.vim/ftdetect/sh.vim, -" and if it isn't, we'll throw away the highlighting groups for ksh. -if exists('g:is_posix') && exists('g:is_kornshell') && !exists('b:is_ksh') +" script using our own b:is_kornshell_proper flag set at the end of +" ~/.vim/ftdetect/sh.vim, and if it isn't, we'll throw away the highlighting +" groups for ksh. +if exists('g:is_kornshell') && !exists('b:is_ksh') syntax clear kshSpecialVariables syntax clear kshStatement endif -- cgit v1.2.3