aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-11-12 14:42:59 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-11-12 20:27:54 +1300
commit6e9eb56edb2c5ec48e6daac0b46219c8a2bd24c0 (patch)
treebe1d47def25a5cfbfd4e10905c05a2ec26803f33 /Makefile
parentMerge branch 'feature/vim-plug-boilplate' into develop (diff)
downloaddotfiles-6e9eb56edb2c5ec48e6daac0b46219c8a2bd24c0.tar.gz
dotfiles-6e9eb56edb2c5ec48e6daac0b46219c8a2bd24c0.zip
Move lots of local Vim config into vim/after
This is a relatively drastic change that should have been done progressively, but I got carried away in ripping everything out and putting it back in again. Reading the documentation for writing a Vim script (:help usr_41.txt), I am convinced that all of the content that was in the vim/ftplugin directory and some of the vim/indent directory actually belonged in vim/after/ftplugin and vim/after/indent respectively. This is because the section on filetypes makes the distinction between replacing the core filetype or indent plugins and merely adding to or editing them after the fact; from :help ftplugin: > If you do want to use the default plugin, but overrule one of the > settings, you can write the different setting in a script: > > setlocal textwidth=70 > > Now write this in the "after" directory, so that it gets sourced after > the distributed "vim.vim" ftplugin after-directory. For Unix this > would be "~/.vim/after/ftplugin/vim.vim". Note that the default > plugin will have set "b:did_ftplugin", but it is ignored here. Therefore, I have deleted the user_indent.vim and user_ftplugin.vim plugins and their documentation that I wrote, and their ftplugin.vim and indent.vim shims in ~/.vim, in an attempt to make these plugins elegantly undo-ready, and instead embraced the way the documentation and $VIMRUNTIME structure seems to suggest. I broke the ftplugin files up by function and put them under subdirectories of vim/after named by filetype, as the 'runtimepath' layout permits. In doing so, I also carefully applied the documentation's advice: * Short-circuiting repeated loads * Checking for existing mappings using the <Plug> prefix approach * Avoiding repeated function declarations overwriting each other * Guarding against 'cpotions' mangling things (by simply short-circuiting if 'compatible' is set). I've made the b:undo_ftplugin and b:undo_indent commands less forgiving, and append commands to it inline with the initial establishment of the setup they're reversing, including checking that the b:undo_* variable actually exists in the first place. For the indentation scripts, however, three of the four files originally in vim/indent actually do belong there: 1. csv.vim, because it doesn't have an indent file in the core. 2. tsv.vim, because it doesn't have an indent file in the core. 3. php.vim, because it does what ftplugins are allowed to do in preventing the core indent rules from running at all. The indent/vim.vim rules, however, have been moved to after/indent/vim.vim, because the tweaks it makes for two-space indentation are designed to supplement the core indent rules, not replace them. Finally, I've adjusted Makefile targets accordingly for the above, given the vim/ftplugin directory is now empty and there are three new directories in vim/after to install. We wrap these under a single `install-vim-after` parent target for convenience. The `install-vim-after-ftplugin` target accommodates the additional level of filetype directories beneath it.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile33
1 files changed, 21 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 196f3ed5..63d192f8 100644
--- a/Makefile
+++ b/Makefile
@@ -39,11 +39,13 @@
install-urxvt \
install-vim \
install-vim-after \
+ install-vim-after-ftdetect \
+ install-vim-after-indent \
+ install-vim-after-syntax \
install-vim-autoload \
install-vim-bundle \
install-vim-config \
install-vim-ftdetect \
- install-vim-ftplugin \
install-vim-gui \
install-vim-gui-config \
install-vim-indent \
@@ -483,14 +485,27 @@ install-vim: install-vim-after \
install-vim-config \
install-vim-doc \
install-vim-ftdetect \
- install-vim-ftplugin \
install-vim-indent \
install-vim-plugin
-install-vim-after:
- find vim/after -name .git -prune -o \
- -type d -exec sh -c 'mkdir -p -- $(HOME)/."$$1"' _ {} \; -o \
- -type f -exec sh -c 'cp -p -- "$$1" $(HOME)/."$$1"' _ {} \;
+install-vim-after: install-vim-after-ftplugin \
+ install-vim-after-indent \
+ install-vim-after-syntax
+
+install-vim-after-ftplugin:
+ mkdir -p $(HOME)/.vim/after/ftplugin
+ for type in vim/after/ftplugin/* ; do \
+ mkdir -p -- $(HOME)/.vim/after/ftplugin/"$${type##*/}" ; \
+ cp -p "$$type"/* $(HOME)/.vim/after/ftplugin/"$${type##*/}" ; \
+ done
+
+install-vim-after-indent:
+ mkdir -p $(HOME)/.vim/after/indent
+ cp -p -- vim/after/indent/*.vim $(HOME)/.vim/after/indent
+
+install-vim-after-syntax:
+ mkdir -p $(HOME)/.vim/after/syntax
+ cp -p -- vim/after/syntax/*.vim $(HOME)/.vim/after/syntax
install-vim-autoload:
mkdir -p -- $(HOME)/.vim/autoload
@@ -514,14 +529,8 @@ install-vim-ftdetect:
mkdir -p -- $(HOME)/.vim/ftdetect
cp -p -- vim/ftdetect/*.vim $(HOME)/.vim/ftdetect
-install-vim-ftplugin:
- mkdir -p -- $(HOME)/.vim/ftplugin
- cp -p -- vim/ftplugin.vim $(HOME)/.vim/ftplugin.vim
- cp -p -- vim/ftplugin/*.vim $(HOME)/.vim/ftplugin
-
install-vim-indent:
mkdir -p -- $(HOME)/.vim/indent
- cp -p -- vim/indent.vim $(HOME)/.vim/indent.vim
cp -p -- vim/indent/*.vim $(HOME)/.vim/indent
install-vim-plugin: