diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-11 17:49:33 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-11 17:49:33 +1300 |
commit | a84862f0e11341ad98cb1317ce32ed862710eeb8 (patch) | |
tree | eee3bfbe7cfdf1edb30117b2115561717a996997 | |
parent | Wrap b:is_ksh hack in an autocmd (diff) | |
download | dotfiles-a84862f0e11341ad98cb1317ce32ed862710eeb8.tar.gz dotfiles-a84862f0e11341ad98cb1317ce32ed862710eeb8.zip |
Wrap sh autocmds in a group to be polite
-rw-r--r-- | vim/after/ftdetect/sh.vim | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/vim/after/ftdetect/sh.vim b/vim/after/ftdetect/sh.vim index b3118fbc..3bc10ba7 100644 --- a/vim/after/ftdetect/sh.vim +++ b/vim/after/ftdetect/sh.vim @@ -1,26 +1,31 @@ -" Names/paths of things that are Bash shell script -autocmd BufNewFile,BufRead - \ **/.dotfiles/bash/**,bash-fc-* - \ let b:is_bash = 1 | - \ setlocal filetype=sh +" Add automatic commands to +augroup dfsh -" Names/paths of things that are Korn shell script -autocmd BufNewFile,BufRead - \ **/.dotfiles/pdksh/**,.pdkshrc,*.pdksh - \ let b:is_kornshell = 1 | - \ setlocal filetype=sh + " Names/paths of things that are Bash shell script + autocmd BufNewFile,BufRead + \ **/.dotfiles/bash/**,bash-fc-* + \ let b:is_bash = 1 | + \ setlocal filetype=sh -" Names/paths of things that are POSIX shell script -autocmd BufNewFile,BufRead - \ **/.dotfiles/sh/**,.shinit,.shrc,.xinitrc,/etc/default/* - \ let b:is_posix = 1 | - \ setlocal filetype=sh + " Names/paths of things that are Korn shell script + autocmd BufNewFile,BufRead + \ **/.dotfiles/pdksh/**,.pdkshrc,*.pdksh + \ let b:is_kornshell = 1 | + \ setlocal filetype=sh -" If we determined something is b:is_kornshell, tack on b:is_ksh as well so we -" can still tease out what is actually a kornshell script after sh.vim is done -" changing our options for us; it conflates POSIX with Korn shell. -autocmd BufNewFile,BufRead - \ * - \ if exists('b:is_kornshell') | - \ let b:is_ksh = 1 | - \ endif + " Names/paths of things that are POSIX shell script + autocmd BufNewFile,BufRead + \ **/.dotfiles/sh/**,.shinit,.shrc,.xinitrc,/etc/default/* + \ let b:is_posix = 1 | + \ setlocal filetype=sh + + " If we determined something is b:is_kornshell, tack on b:is_ksh as well so + " we can still tease out what is actually a kornshell script after sh.vim is + " done changing our options for us; it conflates POSIX with Korn shell. + autocmd BufNewFile,BufRead + \ * + \ if exists('b:is_kornshell') | + \ let b:is_ksh = 1 | + \ endif + +augroup END |