From f8af47bc44386b18bc9d854219e20ebf3820bd43 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 30 Oct 2017 11:29:32 +1300 Subject: Move vim/after/ftdetect to vim/ftdetect There's no particular reason to run these file detection rules after the plugins have run, so we'll put them in a more expected directory. I've created a new Makefile target to install this, `install-vim-ftdetect`, which is included as a prerequisite of the `install-vim` target. --- vim/ftdetect/muttrc.vim | 12 ++++++++++++ vim/ftdetect/sh.vim | 31 +++++++++++++++++++++++++++++++ vim/ftdetect/xdefaults.vim | 6 ++++++ 3 files changed, 49 insertions(+) create mode 100644 vim/ftdetect/muttrc.vim create mode 100644 vim/ftdetect/sh.vim create mode 100644 vim/ftdetect/xdefaults.vim (limited to 'vim/ftdetect') diff --git a/vim/ftdetect/muttrc.vim b/vim/ftdetect/muttrc.vim new file mode 100644 index 00000000..ff3776b5 --- /dev/null +++ b/vim/ftdetect/muttrc.vim @@ -0,0 +1,12 @@ +" Add automatic commands to detect .muttrc files +augroup dfmuttrc + + autocmd BufNewFile,BufRead + \ **/.dotfiles/mutt/muttrc.d/*.rc + \ setlocal filetype=muttrc + + autocmd BufNewFile,BufRead + \ **/.muttrc.d/*.rc + \ setlocal filetype=muttrc + +augroup END diff --git a/vim/ftdetect/sh.vim b/vim/ftdetect/sh.vim new file mode 100644 index 00000000..f2bc0df2 --- /dev/null +++ b/vim/ftdetect/sh.vim @@ -0,0 +1,31 @@ +" Add automatic commands to choose shell flavours based on filename pattern +augroup dfsh + + " 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 Korn shell script + autocmd BufNewFile,BufRead + \ **/.dotfiles/ksh/**,.kshrc,*.ksh + \ 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 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 diff --git a/vim/ftdetect/xdefaults.vim b/vim/ftdetect/xdefaults.vim new file mode 100644 index 00000000..f0ee7b81 --- /dev/null +++ b/vim/ftdetect/xdefaults.vim @@ -0,0 +1,6 @@ +" Add automatic commands to find Xresources subfiles +augroup dfxdefaults + autocmd BufNewFile,BufRead + \ **/.Xresources.d/* + \ setlocal filetype=xdefaults +augroup END -- cgit v1.2.3