diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-11 14:55:10 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-11 14:55:10 +1300 |
commit | d5d77ee7f5b6fd23bfb899137c1aef282177748f (patch) | |
tree | b2346172b47e3f93c280172cd0df74e4b7f44a42 /vim/after | |
parent | Make POSIX default for shell more specific (diff) | |
download | dotfiles-d5d77ee7f5b6fd23bfb899137c1aef282177748f.tar.gz dotfiles-d5d77ee7f5b6fd23bfb899137c1aef282177748f.zip |
Set buffer type (not global type) for sh properly
Diffstat (limited to 'vim/after')
-rw-r--r-- | vim/after/ftdetect/sh.vim | 6 | ||||
-rw-r--r-- | vim/after/ftplugin/sh.vim | 9 |
2 files changed, 9 insertions, 6 deletions
diff --git a/vim/after/ftdetect/sh.vim b/vim/after/ftdetect/sh.vim index 3a9fa531..73bbfffe 100644 --- a/vim/after/ftdetect/sh.vim +++ b/vim/after/ftdetect/sh.vim @@ -1,17 +1,17 @@ " Names/paths of things that are Bash shell script autocmd BufNewFile,BufRead \ **/.dotfiles/bash/**,bash-fc-* - \ let g:is_bash = 1 | + \ let b:is_bash = 1 | \ setlocal filetype=sh " Names/paths of things that are Korn shell script autocmd BufNewFile,BufRead \ **/.dotfiles/pdksh/**,.pdkshrc,*.pdksh - \ let g:is_kornshell = 1 | + \ let b:is_kornshell = 1 | \ setlocal filetype=sh " Names/paths of things that are POSIX shell script autocmd BufNewFile,BufRead \ **/.dotfiles/sh/**,.shinit,.shrc,.xinitrc,/etc/default/* - \ let g:is_posix = 1 | + \ let b:is_posix = 1 | \ setlocal filetype=sh diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim index c9e0297c..c79dab74 100644 --- a/vim/after/ftplugin/sh.vim +++ b/vim/after/ftplugin/sh.vim @@ -1,6 +1,9 @@ -" If the file is not already tagged as either ksh nor bash, assume POSIX shell -if !exists('g:is_kornshell') && !exists('g:is_bash') - let g:is_posix = 1 +" If the file is not already tagged as a shell type, default to POSIX shell, +" as I never write Bourne. I would set g:is_posix here rather than b:is_posix, +" but sh.vim makes some weird assumptions about me actually meaning ksh for +" some reason when I do that. +if !exists('b:is_kornshell') && !exists('b:is_bash') && !exists('b:is_posix') + let b:is_posix = 1 endif " Use han(1df) as a man(1) wrapper for Bash files if available |