aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-06-02 21:46:35 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-06-02 21:46:35 +1200
commit8b9887ad91f4374069afe387acc5df1c90f23c0c (patch)
tree761f66311f826ef78fa3b488cc79041389d26800
parentRebuild help tags after installing bundle (diff)
downloaddotfiles-8b9887ad91f4374069afe387acc5df1c90f23c0c.tar.gz
dotfiles-8b9887ad91f4374069afe387acc5df1c90f23c0c.zip
Refactor Vim distribution plugin/macro handling
Intelligently choose how to load matchit.vim, and clean up the short-circuit variables for the unwanted distribution plugins in an "after" plugin script.
-rw-r--r--Makefile11
-rw-r--r--vim/after/plugin/dist.vim10
-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/plugin/macros.vim5
6 files changed, 61 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index 3718e2e5..940ae9ef 100644
--- a/Makefile
+++ b/Makefile
@@ -41,6 +41,7 @@
install-vim-after \
install-vim-after-ftdetect \
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
@@ -551,6 +558,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/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/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/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