aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-06-03 12:52:27 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-06-03 12:52:27 +1200
commitb16ddff69d781143f210c3c629be27c9e68f5626 (patch)
tree4d068fd14280daf5f26fa44eb7e8629ed0a274d7
parentMerge branch 'release/v0.42.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-b16ddff69d781143f210c3c629be27c9e68f5626.tar.gz
dotfiles-b16ddff69d781143f210c3c629be27c9e68f5626.zip
Merge branch 'release/v0.43.0'v0.43.0
* release/v0.43.0: Bump VERSION Revamp vint script with blacklist not whitelist Add missing vint targets Add shebang and opening tag detect for PHP Refine shebangs in filetype detection Implement personal filetype.vim Correct name of Makefile target Refactor Vim distribution plugin/macro handling Rebuild help tags after installing bundle Use full commands in buffer cycle mappings Upgrade mail_mutt.vim plugin to v0.2.0
-rw-r--r--Makefile15
-rw-r--r--VERSION4
-rw-r--r--lint/vim.sh37
-rw-r--r--vim/after/plugin/dist.vim10
m---------vim/bundle/mail_mutt0
-rw-r--r--vim/config/buffers.vim4
-rw-r--r--vim/config/dist.vim30
-rw-r--r--vim/config/packages.vim5
-rw-r--r--vim/config/plugin.vim33
-rw-r--r--vim/filetype.vim11
-rw-r--r--vim/ftdetect/;12
-rw-r--r--vim/ftdetect/awk.vim9
-rw-r--r--vim/ftdetect/c.vim4
-rw-r--r--vim/ftdetect/cpp.vim4
-rw-r--r--vim/ftdetect/css.vim4
-rw-r--r--vim/ftdetect/csv.vim2
-rw-r--r--vim/ftdetect/diff.vim4
-rw-r--r--vim/ftdetect/gitcommit.vim4
-rw-r--r--vim/ftdetect/gitconfig.vim4
-rw-r--r--vim/ftdetect/gpg.vim4
-rw-r--r--vim/ftdetect/html.vim4
-rw-r--r--vim/ftdetect/java.vim4
-rw-r--r--vim/ftdetect/javascript.vim4
-rw-r--r--vim/ftdetect/json.vim4
-rw-r--r--vim/ftdetect/lex.vim4
-rw-r--r--vim/ftdetect/lua.vim4
-rw-r--r--vim/ftdetect/m4.vim4
-rw-r--r--vim/ftdetect/make.vim4
-rw-r--r--vim/ftdetect/markdown.vim4
-rw-r--r--vim/ftdetect/muttrc.vim4
-rw-r--r--vim/ftdetect/perl.vim9
-rw-r--r--vim/ftdetect/perl6.vim9
-rw-r--r--vim/ftdetect/php.vim12
-rw-r--r--vim/ftdetect/pod.vim4
-rw-r--r--vim/ftdetect/pod6.vim4
-rw-r--r--vim/ftdetect/python.vim9
-rw-r--r--vim/ftdetect/readline.vim4
-rw-r--r--vim/ftdetect/remind.vim4
-rw-r--r--vim/ftdetect/sh.vim50
-rw-r--r--vim/ftdetect/tmux.vim4
-rw-r--r--vim/ftdetect/troff.vim4
-rw-r--r--vim/ftdetect/tsv.vim2
-rw-r--r--vim/ftdetect/vim.vim4
-rw-r--r--vim/ftdetect/viminfo.vim4
-rw-r--r--vim/ftdetect/xdefaults.vim2
-rw-r--r--vim/ftdetect/xhtml.vim4
-rw-r--r--vim/ftdetect/xml.vim4
-rw-r--r--vim/ftdetect/yacc.vim4
-rw-r--r--vim/ftdetect/yaml.vim4
-rw-r--r--vim/ftdetect/zsh.vim9
-rw-r--r--vim/plugin/macros.vim5
51 files changed, 326 insertions, 69 deletions
diff --git a/Makefile b/Makefile
index 2b494a91..fd08950d 100644
--- a/Makefile
+++ b/Makefile
@@ -39,8 +39,9 @@
install-urxvt \
install-vim \
install-vim-after \
- install-vim-after-ftdetect \
+ install-vim-after-ftplugin \
install-vim-after-indent \
+ install-vim-after-plugin \
install-vim-after-syntax \
install-vim-bundle \
install-vim-compiler \
@@ -50,6 +51,7 @@
install-vim-gui \
install-vim-gui-config \
install-vim-indent \
+ install-vim-plugin \
install-vint \
install-wget \
install-x \
@@ -498,6 +500,7 @@ install-vim: install-vim-after \
install-vim-after: install-vim-after-ftplugin \
install-vim-after-indent \
+ install-vim-after-plugin \
install-vim-after-syntax
install-vim-after-ftplugin:
@@ -511,6 +514,10 @@ install-vim-after-indent:
mkdir -p $(VIMDIR)/after/indent
cp -p -- vim/after/indent/*.vim $(VIMDIR)/after/indent
+install-vim-after-plugin:
+ mkdir -p $(VIMDIR)/after/plugin
+ cp -p -- vim/after/plugin/*.vim $(VIMDIR)/after/plugin
+
install-vim-after-syntax:
mkdir -p $(VIMDIR)/after/syntax
cp -p -- vim/after/syntax/*.vim $(VIMDIR)/after/syntax
@@ -522,6 +529,7 @@ install-vim-bundle: install-vim-config
find vim/bundle/*/*/* \
-type f -exec sh -c \
'cp -p -- "$$1" $(VIMDIR)/"$${1#vim/bundle/*/}"' _ {} \;
+ vim -eT dumb -c 'helptags $(VIMDIR)/doc' -c quit
install-vim-compiler:
mkdir -p -- $(VIMDIR)/compiler
@@ -534,6 +542,7 @@ install-vim-config:
install-vim-ftdetect:
mkdir -p -- $(VIMDIR)/ftdetect
+ cp -p -- vim/filetype.vim $(VIMDIR)
cp -p -- vim/ftdetect/*.vim $(VIMDIR)/ftdetect
install-vim-ftplugin:
@@ -550,6 +559,10 @@ install-vim-gui: install-vim \
install-vim-gui-config:
cp -p -- vim/gvimrc $(HOME)/.gvimrc
+install-vim-plugin:
+ mkdir -p -- $(VIMDIR)/plugin
+ cp -p -- vim/plugin/*.vim $(VIMDIR)/plugin
+
install-vint:
cp -p -- vint/vintrc.yaml $(HOME)/.vintrc.yaml
diff --git a/VERSION b/VERSION
index 9f9e9114..dcd68db6 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-tejr dotfiles v0.42.0
-Sat Jun 2 05:39:14 UTC 2018
+tejr dotfiles v0.43.0
+Sun Jun 3 00:51:04 UTC 2018
diff --git a/lint/vim.sh b/lint/vim.sh
index 64d87e8d..43eaf4c8 100644
--- a/lint/vim.sh
+++ b/lint/vim.sh
@@ -1,21 +1,20 @@
-set -- \
- vim/after \
- vim/bundle/auto_cache_dirs \
- vim/bundle/big_file_options \
- vim/bundle/copy_linebreak \
- vim/bundle/fixed_join \
- vim/bundle/insert_suspend_hlsearch \
- vim/bundle/juvenile \
- vim/bundle/mail_mutt \
- vim/bundle/sahara \
- vim/bundle/strip_trailing_whitespace \
- vim/bundle/toggle_option_flags \
- vim/bundle/uncap_ex \
- vim/compiler \
- vim/config \
- vim/ftdetect \
- vim/gvimrc \
- vim/indent \
- vim/vimrc
+# Build an argument list of checks to make
+set --
+for vim in vim/* vim/bundle/* ; do
+ [ -e "$vim" ] || continue
+ case $vim in
+
+ # Skip third-party plugins
+ vim/bundle) ;;
+ vim/bundle/repeat) ;;
+ vim/bundle/surround) ;;
+
+ # Check everything else
+ *) set -- "$@" "$vim" ;;
+
+ esac
+done
+
+# Run check
vint -s -- "$@" || exit
printf 'Vim configuration linted successfully.\n'
diff --git a/vim/after/plugin/dist.vim b/vim/after/plugin/dist.vim
new file mode 100644
index 00000000..4613925f
--- /dev/null
+++ b/vim/after/plugin/dist.vim
@@ -0,0 +1,10 @@
+" Clean up the short-circuiting variables from config/plugins.vim
+unlet! g:loaded_getscriptPlugin
+unlet! g:loaded_vimballPlugin
+unlet! g:loaded_logiPat
+unlet! g:loaded_netrwPlugin
+unlet! g:loaded_rrhelper
+unlet! g:loaded_spellfile_plugin
+unlet! g:loaded_gzip
+unlet! g:loaded_tarPlugin
+unlet! g:loaded_zipPlugin
diff --git a/vim/bundle/mail_mutt b/vim/bundle/mail_mutt
-Subproject 8f417d2ac92b1247b24103963e64bf63d627de3
+Subproject 3e0e4306641a759758a4eb746708f0efec9cc7e
diff --git a/vim/config/buffers.vim b/vim/config/buffers.vim
index ddd40b9f..b5a0151b 100644
--- a/vim/config/buffers.vim
+++ b/vim/config/buffers.vim
@@ -8,7 +8,7 @@ endif
" Cycle back and forth through buffers.
nnoremap <silent>
\ [b
- \ :<C-U>bp<CR>
+ \ :<C-U>bprevious<CR>
nnoremap <silent>
\ ]b
- \ :<C-U>bn<CR>
+ \ :<C-U>bnext<CR>
diff --git a/vim/config/dist.vim b/vim/config/dist.vim
new file mode 100644
index 00000000..0a20be48
--- /dev/null
+++ b/vim/config/dist.vim
@@ -0,0 +1,30 @@
+" Disable most core plugin stuff that I don't use; after/plugin/dist.vim
+" clears these variables later
+if has('eval')
+
+ " 2html.vim is often useful, so keep that
+ " matchparen.vim I use constantly
+
+ " I handle versioning plugins manually, and have never used .vba
+ let g:loaded_getscriptPlugin = 1
+ let g:loaded_vimballPlugin = 1
+
+ " This is what grep, sed, Awk, and Perl are for
+ let g:loaded_logiPat = 1
+
+ " ^Z, my dudes
+ let g:loaded_netrwPlugin = 1
+
+ " Vim servers? What is this, Emacs?
+ let g:loaded_rrhelper = 1
+
+ " System dictionaries plus custom per-machine spell files are fine
+ let g:loaded_spellfile_plugin = 1
+
+ " If I want to read a file or a file archived within it I'll decompress or
+ " unarchive it myself; a text editor should not do this
+ let g:loaded_gzip = 1
+ let g:loaded_tarPlugin = 1
+ let g:loaded_zipPlugin = 1
+
+endif
diff --git a/vim/config/packages.vim b/vim/config/packages.vim
new file mode 100644
index 00000000..f03595eb
--- /dev/null
+++ b/vim/config/packages.vim
@@ -0,0 +1,5 @@
+" Add the packaged version of matchit.vim included in the distribution, if
+" possible; after/plugin/macros.vim loads this for older Vims
+if has('packages')
+ silent! packadd! matchit
+endif
diff --git a/vim/config/plugin.vim b/vim/config/plugin.vim
deleted file mode 100644
index 6e79b255..00000000
--- a/vim/config/plugin.vim
+++ /dev/null
@@ -1,33 +0,0 @@
-" Try to run the version of matchit.vim included in the distribution, if there
-" is one; extends % to match more than it does by default
-silent! runtime macros/matchit.vim
-
-" Disable most core plugin stuff that I don't use
-if has('eval')
-
- " 2html.vim is often useful, so keep that
- " matchparen.vim I use constantly
-
- " I handle versioning plugins manually, and have never used .vba
- let g:loaded_getscriptPlugin = 'skipped'
- let g:loaded_vimballPlugin = 'skipped'
-
- " This is what grep, sed, Awk, and Perl are for
- let g:loaded_logiPat = 'skipped'
-
- " ^Z, my dudes
- let g:loaded_netrwPlugin = 'skipped'
-
- " Vim servers? What is this, Emacs?
- let g:loaded_rrhelper = 'skipped'
-
- " System dictionaries plus custom per-machine spell files are fine
- let g:loaded_spellfile_plugin = 'skipped'
-
- " If I want to read a file or a file archived within it I'll decompress or
- " unarchive it myself; a text editor should not do this
- let g:loaded_gzip = 'skipped'
- let g:loaded_tarPlugin = 'skipped'
- let g:loaded_zipPlugin = 'skipped'
-
-endif
diff --git a/vim/filetype.vim b/vim/filetype.vim
new file mode 100644
index 00000000..2abe7831
--- /dev/null
+++ b/vim/filetype.vim
@@ -0,0 +1,11 @@
+" Override filetypes.vim
+if exists('g:did_load_filetypes')
+ finish
+endif
+let g:did_load_filetypes = 1
+
+" Use only the rules in ftdetect
+augroup filetypedetect
+ autocmd!
+ runtime! ftdetect/*.vim
+augroup END
diff --git a/vim/ftdetect/; b/vim/ftdetect/;
new file mode 100644
index 00000000..f57ba0e6
--- /dev/null
+++ b/vim/ftdetect/;
@@ -0,0 +1,12 @@
+" PHP files
+autocmd BufNewFile,BufRead
+ \ *.php
+ \ setfiletype php
+autocmd BufNewFile,BufRead
+ \ *
+ \ if getline(1) =~# '\m^#!.\<php\>'
+ \ | setfiletype php
+ \ | endif
+ \ | if getline(1) =~? '\m^<?php\>'
+ \ | setfiletype php
+ \ | endif
diff --git a/vim/ftdetect/awk.vim b/vim/ftdetect/awk.vim
new file mode 100644
index 00000000..9965235e
--- /dev/null
+++ b/vim/ftdetect/awk.vim
@@ -0,0 +1,9 @@
+" AWK files
+autocmd BufNewFile,BufRead
+ \ *.awk
+ \ setfiletype awk
+autocmd BufNewFile,BufRead
+ \ *
+ \ if getline(1) =~# '\m^#!.*\<[gm]\?awk\>'
+ \ | setfiletype awk
+ \ | endif
diff --git a/vim/ftdetect/c.vim b/vim/ftdetect/c.vim
new file mode 100644
index 00000000..77a73cb6
--- /dev/null
+++ b/vim/ftdetect/c.vim
@@ -0,0 +1,4 @@
+" C files
+autocmd BufNewFile,BufRead
+ \ *.c,*.h
+ \ setfiletype c
diff --git a/vim/ftdetect/cpp.vim b/vim/ftdetect/cpp.vim
new file mode 100644
index 00000000..71dc59e5
--- /dev/null
+++ b/vim/ftdetect/cpp.vim
@@ -0,0 +1,4 @@
+" C++ files
+autocmd BufNewFile,BufRead
+ \ *.c++,*.cpp,*.cxx,*.hh
+ \ setfiletype cpp
diff --git a/vim/ftdetect/css.vim b/vim/ftdetect/css.vim
new file mode 100644
index 00000000..bd98aa8e
--- /dev/null
+++ b/vim/ftdetect/css.vim
@@ -0,0 +1,4 @@
+" CSS files
+autocmd BufNewFile,BufRead
+ \ *.css
+ \ setfiletype css
diff --git a/vim/ftdetect/csv.vim b/vim/ftdetect/csv.vim
index a234c093..33468496 100644
--- a/vim/ftdetect/csv.vim
+++ b/vim/ftdetect/csv.vim
@@ -1,4 +1,4 @@
-" Add automatic commands to detect CSV files
+" CSV files
autocmd BufNewFile,BufRead
\ *.csv
\ setfiletype csv
diff --git a/vim/ftdetect/diff.vim b/vim/ftdetect/diff.vim
new file mode 100644
index 00000000..d19fc450
--- /dev/null
+++ b/vim/ftdetect/diff.vim
@@ -0,0 +1,4 @@
+" Diff and patch files
+autocmd BufNewFile,BufRead
+ \ *.diff,*.patch,*.rej
+ \ setfiletype diff
diff --git a/vim/ftdetect/gitcommit.vim b/vim/ftdetect/gitcommit.vim
new file mode 100644
index 00000000..1c21544a
--- /dev/null
+++ b/vim/ftdetect/gitcommit.vim
@@ -0,0 +1,4 @@
+" Git commit messages
+autocmd BufNewFile,BufRead
+ \ COMMIT_EDITMSG,MERGE_MSG,TAG_EDITMSG
+ \ setfiletype gitcommit
diff --git a/vim/ftdetect/gitconfig.vim b/vim/ftdetect/gitconfig.vim
new file mode 100644
index 00000000..780e89b0
--- /dev/null
+++ b/vim/ftdetect/gitconfig.vim
@@ -0,0 +1,4 @@
+" Git config files
+autocmd BufNewFile,BufRead
+ \ *.git*/config,.gitconfig,.gitmodules
+ \ setfiletype gitconfig
diff --git a/vim/ftdetect/gpg.vim b/vim/ftdetect/gpg.vim
new file mode 100644
index 00000000..ea6ec2f6
--- /dev/null
+++ b/vim/ftdetect/gpg.vim
@@ -0,0 +1,4 @@
+" GnuPG configuration files
+autocmd BufNewFile,BufRead
+ \ *gnupg/options,*gnupg/gpg.conf
+ \ setfiletype gpg
diff --git a/vim/ftdetect/html.vim b/vim/ftdetect/html.vim
new file mode 100644
index 00000000..f8ab7ac5
--- /dev/null
+++ b/vim/ftdetect/html.vim
@@ -0,0 +1,4 @@
+" HTML files
+autocmd BufNewFile,BufRead
+ \ *.html,*.htm
+ \ setfiletype html
diff --git a/vim/ftdetect/java.vim b/vim/ftdetect/java.vim
new file mode 100644
index 00000000..101816ea
--- /dev/null
+++ b/vim/ftdetect/java.vim
@@ -0,0 +1,4 @@
+" Java files
+autocmd BufNewFile,BufRead
+ \ *.java,*.jav
+ \ setfiletype java
diff --git a/vim/ftdetect/javascript.vim b/vim/ftdetect/javascript.vim
new file mode 100644
index 00000000..6f129960
--- /dev/null
+++ b/vim/ftdetect/javascript.vim
@@ -0,0 +1,4 @@
+" JSON files
+autocmd BufNewFile,BufRead
+ \ *.js
+ \ setfiletype javascript
diff --git a/vim/ftdetect/json.vim b/vim/ftdetect/json.vim
new file mode 100644
index 00000000..fd27c845
--- /dev/null
+++ b/vim/ftdetect/json.vim
@@ -0,0 +1,4 @@
+" JSON files
+autocmd BufNewFile,BufRead
+ \ *.json
+ \ setfiletype json
diff --git a/vim/ftdetect/lex.vim b/vim/ftdetect/lex.vim
new file mode 100644
index 00000000..23118468
--- /dev/null
+++ b/vim/ftdetect/lex.vim
@@ -0,0 +1,4 @@
+" Lex files
+autocmd BufNewFile,BufRead
+ \ *.l,*.lex
+ \ setfiletype lex
diff --git a/vim/ftdetect/lua.vim b/vim/ftdetect/lua.vim
new file mode 100644
index 00000000..d6c635a0
--- /dev/null
+++ b/vim/ftdetect/lua.vim
@@ -0,0 +1,4 @@
+" Lua files
+autocmd BufNewFile,BufRead
+ \ *.lua
+ \ setfiletype lua
diff --git a/vim/ftdetect/m4.vim b/vim/ftdetect/m4.vim
new file mode 100644
index 00000000..c7d97e80
--- /dev/null
+++ b/vim/ftdetect/m4.vim
@@ -0,0 +1,4 @@
+" m4 files
+autocmd BufNewFile,BufRead
+ \ *.m4
+ \ setfiletype m4
diff --git a/vim/ftdetect/make.vim b/vim/ftdetect/make.vim
new file mode 100644
index 00000000..0ce0514b
--- /dev/null
+++ b/vim/ftdetect/make.vim
@@ -0,0 +1,4 @@
+" Makefiles
+autocmd BufNewFile,BufRead
+ \ Makefile,makefile
+ \ setfiletype make
diff --git a/vim/ftdetect/markdown.vim b/vim/ftdetect/markdown.vim
new file mode 100644
index 00000000..21ff2dcb
--- /dev/null
+++ b/vim/ftdetect/markdown.vim
@@ -0,0 +1,4 @@
+" Markdown files
+autocmd BufNewFile,BufRead
+ \ *.markdown,*.md
+ \ setfiletype markdown
diff --git a/vim/ftdetect/muttrc.vim b/vim/ftdetect/muttrc.vim
index 60d31575..48468b30 100644
--- a/vim/ftdetect/muttrc.vim
+++ b/vim/ftdetect/muttrc.vim
@@ -1,4 +1,4 @@
" Add automatic commands to detect .muttrc files
autocmd BufNewFile,BufRead
- \ **/.dotfiles/mutt/muttrc.d/*.rc,**/.muttrc.d/*.rc
- \ setlocal filetype=muttrc
+ \ Muttrc,.muttrc,*muttrc.d/*.rc
+ \ setfiletype muttrc
diff --git a/vim/ftdetect/perl.vim b/vim/ftdetect/perl.vim
new file mode 100644
index 00000000..571e4f58
--- /dev/null
+++ b/vim/ftdetect/perl.vim
@@ -0,0 +1,9 @@
+" Perl 5 files
+autocmd BufNewFile,BufRead
+ \ *.pl,*.pm,*.t,Makefile.PL
+ \ setfiletype perl
+autocmd BufNewFile,BufRead
+ \ *
+ \ if getline(1) =~# '\m^#!.*\<perl\>'
+ \ | setfiletype perl
+ \ | endif
diff --git a/vim/ftdetect/perl6.vim b/vim/ftdetect/perl6.vim
new file mode 100644
index 00000000..67e62c7c
--- /dev/null
+++ b/vim/ftdetect/perl6.vim
@@ -0,0 +1,9 @@
+" Perl 6 files
+autocmd BufNewFile,BufRead
+ \ *.p6,*.pl6,*.pm6
+ \ setfiletype perl6
+autocmd BufNewFile,BufRead
+ \ *
+ \ if getline(1) =~# '\m^#!.\<perl6\>'
+ \ | setfiletype perl6
+ \ | endif
diff --git a/vim/ftdetect/php.vim b/vim/ftdetect/php.vim
new file mode 100644
index 00000000..f57ba0e6
--- /dev/null
+++ b/vim/ftdetect/php.vim
@@ -0,0 +1,12 @@
+" PHP files
+autocmd BufNewFile,BufRead
+ \ *.php
+ \ setfiletype php
+autocmd BufNewFile,BufRead
+ \ *
+ \ if getline(1) =~# '\m^#!.\<php\>'
+ \ | setfiletype php
+ \ | endif
+ \ | if getline(1) =~? '\m^<?php\>'
+ \ | setfiletype php
+ \ | endif
diff --git a/vim/ftdetect/pod.vim b/vim/ftdetect/pod.vim
new file mode 100644
index 00000000..6817b3b4
--- /dev/null
+++ b/vim/ftdetect/pod.vim
@@ -0,0 +1,4 @@
+" Perl 5 POD files
+autocmd BufNewFile,BufRead
+ \ *.pod
+ \ setfiletype pod
diff --git a/vim/ftdetect/pod6.vim b/vim/ftdetect/pod6.vim
new file mode 100644
index 00000000..4ae980a1
--- /dev/null
+++ b/vim/ftdetect/pod6.vim
@@ -0,0 +1,4 @@
+" Perl 6 POD files
+autocmd BufNewFile,BufRead
+ \ *.pod6
+ \ setfiletype pod6
diff --git a/vim/ftdetect/python.vim b/vim/ftdetect/python.vim
new file mode 100644
index 00000000..5c4a4a6f
--- /dev/null
+++ b/vim/ftdetect/python.vim
@@ -0,0 +1,9 @@
+" Python files
+autocmd BufNewFile,BufRead
+ \ *.py
+ \ setfiletype python
+autocmd BufNewFile,BufRead
+ \ *
+ \ if getline(1) =~# '\m^#!.*\<python[23]\?\>'
+ \ | setfiletype python
+ \ | endif
diff --git a/vim/ftdetect/readline.vim b/vim/ftdetect/readline.vim
new file mode 100644
index 00000000..be2565c3
--- /dev/null
+++ b/vim/ftdetect/readline.vim
@@ -0,0 +1,4 @@
+" Readline configuration file
+autocmd BufNewFile,BufRead
+ \ .inputrc,inputrc
+ \ setfiletype readline
diff --git a/vim/ftdetect/remind.vim b/vim/ftdetect/remind.vim
new file mode 100644
index 00000000..f153ad25
--- /dev/null
+++ b/vim/ftdetect/remind.vim
@@ -0,0 +1,4 @@
+" Remind files
+autocmd BufNewFile,BufRead
+ \ *.rem,*.remind,.reminders
+ \ setfiletype remind
diff --git a/vim/ftdetect/sh.vim b/vim/ftdetect/sh.vim
index 880f08e9..1427bc03 100644
--- a/vim/ftdetect/sh.vim
+++ b/vim/ftdetect/sh.vim
@@ -1,19 +1,55 @@
-" Add automatic commands to choose shell flavours based on filename pattern
+" Shell script files; these are hard to detect accurately
-" Names/paths of things that are Bash shell script
+" Bash filename patterns
autocmd BufNewFile,BufRead
- \ **/.dotfiles/bash/**,bash-fc-*
+ \ *.bash,
+ \.bash_aliases,
+ \.bash_logout,
+ \.bash_profile,
+ \.bashrc,
+ \bash-fc-*,
+ \bash_profile,
+ \bashrc
\ let b:is_bash = 1
\ | setfiletype sh
-" Names/paths of things that are Korn shell script
+" Korn shell filename patterns
autocmd BufNewFile,BufRead
- \ **/.dotfiles/ksh/**,.kshrc,*.ksh
+ \ *.ksh,
+ \.kshrc,
+ \kshrc
\ let b:is_kornshell = 1
\ | setfiletype sh
-" Names/paths of things that are POSIX shell script
+" POSIX/Bourne shell filename patterns
autocmd BufNewFile,BufRead
- \ **/.dotfiles/sh/**,.shinit,.shrc,.xinitrc,/etc/default/*
+ \ *.sh,
+ \.profile,
+ \.shinit,
+ \.shrc,
+ \.xinitrc,
+ \/etc/default/*,
+ \configure,
+ \profile,
+ \shinit,
+ \shrc,
+ \xinitrc
\ let b:is_posix = 1
\ | setfiletype sh
+
+" If this file has a shebang, and we haven't already decided it's Bash or
+" Korn shell, use the shebang to decide
+autocmd BufNewFile,BufRead
+ \ *
+ \ if !exists('b:is_bash') && !exists('b:is_kornshell')
+ \ | if getline(1) =~# '\m^#!.*\<bash\>'
+ \ | let b:is_bash = 1
+ \ | setfiletype sh
+ \ | elseif getline(1) =~# '\m^#!.*\<ksh\>'
+ \ | let b:is_ksh = 1
+ \ | setfiletype sh
+ \ | elseif getline(1) =~# '\m^#!.*\<sh\>'
+ \ | let b:is_posix = 1
+ \ | setfiletype sh
+ \ | endif
+ \ | endif
diff --git a/vim/ftdetect/tmux.vim b/vim/ftdetect/tmux.vim
new file mode 100644
index 00000000..4a245586
--- /dev/null
+++ b/vim/ftdetect/tmux.vim
@@ -0,0 +1,4 @@
+" tmux configuration files
+autocmd BufNewFile,BufRead
+ \ .tmux.conf,tmux.conf
+ \ setfiletype tmux
diff --git a/vim/ftdetect/troff.vim b/vim/ftdetect/troff.vim
new file mode 100644
index 00000000..4bd27f6a
--- /dev/null
+++ b/vim/ftdetect/troff.vim
@@ -0,0 +1,4 @@
+" roff files
+autocmd BufNewFile,BufRead
+ \ *.[1-9],*.[1-9]df
+ \ setfiletype nroff
diff --git a/vim/ftdetect/tsv.vim b/vim/ftdetect/tsv.vim
index a345ac65..d6a0a71d 100644
--- a/vim/ftdetect/tsv.vim
+++ b/vim/ftdetect/tsv.vim
@@ -1,4 +1,4 @@
-" Add automatic commands to detect TSV files
+" Tab-separated (TSV) files
autocmd BufNewFile,BufRead
\ *.tsv
\ setfiletype tsv
diff --git a/vim/ftdetect/vim.vim b/vim/ftdetect/vim.vim
new file mode 100644
index 00000000..ca1c26c4
--- /dev/null
+++ b/vim/ftdetect/vim.vim
@@ -0,0 +1,4 @@
+" VimL files
+autocmd BufNewFile,BufRead
+ \ *.vim,vimrc,*[._]vimrc,exrc,*[._]exrc
+ \ setfiletype vim
diff --git a/vim/ftdetect/viminfo.vim b/vim/ftdetect/viminfo.vim
new file mode 100644
index 00000000..31a8c704
--- /dev/null
+++ b/vim/ftdetect/viminfo.vim
@@ -0,0 +1,4 @@
+" .viminfo files
+autocmd BufNewFile,BufRead
+ \ .viminfo
+ \ setfiletype viminfo
diff --git a/vim/ftdetect/xdefaults.vim b/vim/ftdetect/xdefaults.vim
index f45a22a7..896b2e32 100644
--- a/vim/ftdetect/xdefaults.vim
+++ b/vim/ftdetect/xdefaults.vim
@@ -1,4 +1,4 @@
" Add automatic commands to find Xresources subfiles
autocmd BufNewFile,BufRead
- \ **/.Xresources.d/*
+ \ .Xresources,*/.Xresources.d/*
\ setfiletype xdefaults
diff --git a/vim/ftdetect/xhtml.vim b/vim/ftdetect/xhtml.vim
new file mode 100644
index 00000000..adfb1cb5
--- /dev/null
+++ b/vim/ftdetect/xhtml.vim
@@ -0,0 +1,4 @@
+" XHTML files
+autocmd BufNewFile,BufRead
+ \ *.xhtml,*.xht
+ \ setfiletype xhtml
diff --git a/vim/ftdetect/xml.vim b/vim/ftdetect/xml.vim
new file mode 100644
index 00000000..7228e0f3
--- /dev/null
+++ b/vim/ftdetect/xml.vim
@@ -0,0 +1,4 @@
+" XML files
+autocmd BufNewFile,BufRead
+ \ *.xml
+ \ setfiletype xml
diff --git a/vim/ftdetect/yacc.vim b/vim/ftdetect/yacc.vim
new file mode 100644
index 00000000..e3cb5ee8
--- /dev/null
+++ b/vim/ftdetect/yacc.vim
@@ -0,0 +1,4 @@
+" Yacc files
+autocmd BufNewFile,BufRead
+ \ *.y,*.yy
+ \ setfiletype yacc
diff --git a/vim/ftdetect/yaml.vim b/vim/ftdetect/yaml.vim
new file mode 100644
index 00000000..3bf32b53
--- /dev/null
+++ b/vim/ftdetect/yaml.vim
@@ -0,0 +1,4 @@
+" YAML files
+autocmd BufNewFile,BufRead
+ \ *.yaml
+ \ setfiletype yaml
diff --git a/vim/ftdetect/zsh.vim b/vim/ftdetect/zsh.vim
new file mode 100644
index 00000000..08556361
--- /dev/null
+++ b/vim/ftdetect/zsh.vim
@@ -0,0 +1,9 @@
+" Z shell files
+autocmd BufNewFile,BufRead
+ \ *.zsh,.zprofile,zprofile,.zshrc,zshrc
+ \ setfiletype zsh
+autocmd BufNewFile,BufRead
+ \ *
+ \ if getline(1) =~# '^#!.*\<zsh\>'
+ \ | setfiletype zsh
+ \ | endif
diff --git a/vim/plugin/macros.vim b/vim/plugin/macros.vim
new file mode 100644
index 00000000..585eedc8
--- /dev/null
+++ b/vim/plugin/macros.vim
@@ -0,0 +1,5 @@
+" If we don't have packages (Vim < 8.0), try to load matchit.vim from the
+" older macros location in the distributed runtime instead
+if !has('packages')
+ silent! runtime macros/matchit.vim
+endif