From 6bdfa50dfda582b42c78bdf335378e71b35e0fb0 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 31 May 2018 21:52:50 +1200 Subject: Merge auto_*dir.vim plugins into one, spun out Functionality merged into new plugin auto_cache_dir.vim. --- .gitmodules | 3 +++ Makefile | 38 ++------------------------- vim/bundle/auto_cache_dirs | 1 + vim/config/backup.vim | 3 ++- vim/config/swapfile.vim | 5 ++-- vim/config/undo.vim | 2 +- vim/doc/auto_backupdir.txt | 28 -------------------- vim/doc/auto_swapdir.txt | 28 -------------------- vim/doc/auto_undodir.txt | 29 --------------------- vim/plugin/auto_backupdir.vim | 57 ---------------------------------------- vim/plugin/auto_swapdir.vim | 57 ---------------------------------------- vim/plugin/auto_undodir.vim | 60 ------------------------------------------- 12 files changed, 12 insertions(+), 299 deletions(-) create mode 160000 vim/bundle/auto_cache_dirs delete mode 100644 vim/doc/auto_backupdir.txt delete mode 100644 vim/doc/auto_swapdir.txt delete mode 100644 vim/doc/auto_undodir.txt delete mode 100644 vim/plugin/auto_backupdir.vim delete mode 100644 vim/plugin/auto_swapdir.vim delete mode 100644 vim/plugin/auto_undodir.vim diff --git a/.gitmodules b/.gitmodules index e5d27293..53d12410 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,7 @@ # My Vim plugins +[submodule "vim/bundle/auto_cache_dirs"] + path = vim/bundle/auto_cache_dirs + url = https://sanctum.geek.nz/code/vim-auto-cache-dirs.git [submodule "vim/bundle/big_file_options"] path = vim/bundle/big_file_options url = https://sanctum.geek.nz/code/vim-big-file-options.git diff --git a/Makefile b/Makefile index 810da7a7..2b494a91 100644 --- a/Makefile +++ b/Makefile @@ -73,11 +73,7 @@ lint-sh \ lint-urxvt \ lint-vim \ - lint-xinit \ - dist-vim-plugin \ - dist-vim-plugin-auto-backupdir \ - dist-vim-plugin-auto-swapdir \ - dist-vim-plugin-auto-undodir + lint-xinit .SUFFIXES: .SUFFIXES: .awk .bash .m4 .mi5 .pl .sed .sh @@ -496,11 +492,9 @@ install-vim: install-vim-after \ install-vim-bundle \ install-vim-compiler \ install-vim-config \ - install-vim-doc \ install-vim-ftdetect \ install-vim-ftplugin \ - install-vim-indent \ - install-vim-plugin + install-vim-indent install-vim-after: install-vim-after-ftplugin \ install-vim-after-indent \ @@ -538,10 +532,6 @@ install-vim-config: cp -p -- vim/vimrc $(VIMRC) cp -p -- vim/config/*.vim $(VIMDIR)/config -install-vim-doc: - mkdir -p -- $(VIMDIR)/doc - cp -p -- vim/doc/*.txt $(VIMDIR)/doc - install-vim-ftdetect: mkdir -p -- $(VIMDIR)/ftdetect cp -p -- vim/ftdetect/*.vim $(VIMDIR)/ftdetect @@ -554,10 +544,6 @@ install-vim-indent: mkdir -p -- $(VIMDIR)/indent cp -p -- vim/indent/*.vim $(VIMDIR)/indent -install-vim-plugin: - mkdir -p -- $(VIMDIR)/plugin - cp -p -- vim/plugin/*.vim $(VIMDIR)/plugin - install-vim-gui: install-vim \ install-vim-gui-config @@ -657,23 +643,3 @@ lint-vim: lint-xinit: check-xinit sh lint/xinit.sh - -dist-vim-plugin: dist-vim-plugin-auto-backupdir \ - dist-vim-plugin-auto-swapdir \ - dist-vim-plugin-auto-undodir - -dist-vim-plugin-auto-backupdir: \ - vim/plugin/auto_backupdir.vim \ - vim/doc/auto_backupdir.txt \ - VERSION - sh dist/vim-plugin.sh auto_backupdir -dist-vim-plugin-auto-swapdir: \ - vim/plugin/auto_swapdir.vim \ - vim/doc/auto_swapdir.txt \ - VERSION - sh dist/vim-plugin.sh auto_swapdir -dist-vim-plugin-auto-undodir: \ - vim/plugin/auto_undodir.vim \ - vim/doc/auto_undodir.txt \ - VERSION - sh dist/vim-plugin.sh auto_undodir diff --git a/vim/bundle/auto_cache_dirs b/vim/bundle/auto_cache_dirs new file mode 160000 index 00000000..1bfe208f --- /dev/null +++ b/vim/bundle/auto_cache_dirs @@ -0,0 +1 @@ +Subproject commit 1bfe208f58f055f605806d7f5f05a208ae643ce1 diff --git a/vim/config/backup.vim b/vim/config/backup.vim index 8735a094..c0f13126 100644 --- a/vim/config/backup.vim +++ b/vim/config/backup.vim @@ -1,5 +1,6 @@ " Default to no backup files at all, in a way that even ancient/tiny Vims will -" understand; the auto_backupdir.vim plugin will take care of re-enabling this +" understand; the auto_cache_dirs.vim plugin will take care of re-enabling +" this with a 'backupdir' setting set nobackup set nowritebackup diff --git a/vim/config/swapfile.vim b/vim/config/swapfile.vim index bf91aa6b..de0598c2 100644 --- a/vim/config/swapfile.vim +++ b/vim/config/swapfile.vim @@ -1,5 +1,6 @@ -" Default to no swapfile files at all, in a way that even ancient/tiny Vims -" will understand; the auto_swapdir.vim plugin will take care of this +" Default to no swap files at all, in a way that even ancient/tiny Vims will +" understand; the auto_cache_dirs.vim plugin will take care of re-enabling +" this with a 'directory' setting set noswapfile " Don't keep swap files from temporary directories or shared memory in case diff --git a/vim/config/undo.vim b/vim/config/undo.vim index f85d9d8c..b9186d6f 100644 --- a/vim/config/undo.vim +++ b/vim/config/undo.vim @@ -5,7 +5,7 @@ inoremap u set undolevels=2000 " 'undodir' and 'undofile' settings will be taken care of by the -" auto_undodir.vim plugin if applicable/possible +" auto_cache_dirs.vim plugin if applicable/possible if has('persistent_undo') " Turn off the option by default diff --git a/vim/doc/auto_backupdir.txt b/vim/doc/auto_backupdir.txt deleted file mode 100644 index 2990332e..00000000 --- a/vim/doc/auto_backupdir.txt +++ /dev/null @@ -1,28 +0,0 @@ -*auto_backupdir.txt* For Vim version 7.0 Last change: 2017 November 12 - -DESCRIPTION *auto_backupdir* - -This plugin attempts to create a directory "backup" in the directory named by -the first element of 'realtimepath', and enables 'backup' with that as the -'backupdir' if it succeeds or if the directory already exists. - -REQUIREMENTS *auto_backupdir-requirements* - -This plugin is only available if 'compatible' is not set. - -AUTHOR *auto_backupdir-author* - -Written and maintained by Tom Ryder . - -LICENSE *auto_backupdir-license* - -Licensed for distribution under the same terms as Vim itself (see |license|). - -DISTRIBUTION *auto_backupdir-distribution* - -This plugin lives in Tom Ryder's "dotfiles" suite, and may eventually be spun -off into a separate distribution as it solidifies and this documentation -improves. See for more -information. - - vim:tw=78:ts=8:ft=help:norl: diff --git a/vim/doc/auto_swapdir.txt b/vim/doc/auto_swapdir.txt deleted file mode 100644 index a5b8f274..00000000 --- a/vim/doc/auto_swapdir.txt +++ /dev/null @@ -1,28 +0,0 @@ -*auto_swapdir.txt* For Vim version 7.0 Last change: 2017 November 12 - -DESCRIPTION *auto_swapdir* - -This plugin attempts to create a directory "swap" in the directory named by -the first element of 'runtimepath', and enables 'swapfile' with that as the -'directory' if it succeeds or if the directory already exists. - -REQUIREMENTS *auto_swapdir-requirements* - -This plugin is only available if 'compatible' is not set. - -AUTHOR *auto_swapdir-author* - -Written and maintained by Tom Ryder . - -LICENSE *auto_swapdir-license* - -Licensed for distribution under the same terms as Vim itself (see |license|). - -DISTRIBUTION *auto_swapdir-distribution* - -This plugin lives in Tom Ryder's "dotfiles" suite, and may eventually be spun -off into a separate distribution as it solidifies and this documentation -improves. See for more -information. - - vim:tw=78:ts=8:ft=help:norl: diff --git a/vim/doc/auto_undodir.txt b/vim/doc/auto_undodir.txt deleted file mode 100644 index af7a49bf..00000000 --- a/vim/doc/auto_undodir.txt +++ /dev/null @@ -1,29 +0,0 @@ -*auto_undodir.txt* For Vim version 7.0 Last change: 2017 November 12 - -DESCRIPTION *auto_undodir* - -This plugin attempts to create a directory "undo" in the directory named by -the first element of 'runtimepath', and enables 'undofile' with that as the -'undodir' if it succeeds or if the directory already exists. - -REQUIREMENTS *auto_undodir-requirements* - -This plugin is only available if 'compatible' is not set. It also requires the -|+persistent_undo| Vim feature. - -AUTHOR *auto_undodir-author* - -Written and maintained by Tom Ryder . - -LICENSE *auto_undodir-license* - -Licensed for distribution under the same terms as Vim itself (see |license|). - -DISTRIBUTION *auto_undodir-distribution* - -This plugin lives in Tom Ryder's "dotfiles" suite, and may eventually be spun -off into a separate distribution as it solidifies and this documentation -improves. See for more -information. - - vim:tw=78:ts=8:ft=help:norl: diff --git a/vim/plugin/auto_backupdir.vim b/vim/plugin/auto_backupdir.vim deleted file mode 100644 index 1535c486..00000000 --- a/vim/plugin/auto_backupdir.vim +++ /dev/null @@ -1,57 +0,0 @@ -" -" auto_backupdir.vim: Configure 'backupdir' automatically, including trying -" hard to create it. -" -" Author: Tom Ryder -" License: Same as Vim itself -" -if exists('g:loaded_auto_backupdir') || &compatible - finish -endif -let g:loaded_auto_backupdir = 1 - -" Define the backup path we want -if exists('$VIM_BACKUPDIR') - let s:backupdir = $VIM_BACKUPDIR -else - - " This is imperfect in that it will break if you have a backslashed comma in - " the first component of your &runtimepath, but if you're doing that, you - " probably already have way bigger problems - let s:backupdir - \ = strpart(&runtimepath, 0, stridx(&runtimepath, ',')) - \ . '/backup' -endif - -" If the prospective backup directory does not exist, try hard to create it -if !isdirectory(expand(s:backupdir)) - - " Try Vim's native mkdir() first - if exists('*mkdir') - silent! call mkdir(expand(s:backupdir), 'p', 0700) - - " Failing that, use an OS-dependent command - " (Fortunately, Unix and Windows are the only OS types in the world) - elseif has('*shellescape') - if has('unix') - let l:mkdir = '!mkdir -m 0700 -p ' - elseif has('win32') || has('win64') - let l:mkdir = '!mkdir ' - endif - silent! execute l:mkdir - \ . shellescape(expand(s:backupdir)) - endif - -endif - -" If the directory exists after that... -if isdirectory(expand(s:backupdir)) - - " Set the backup directory and turn backups on - execute 'set backupdir^=' . s:backupdir . '//' - set backup - -" If not, give up and raise an error -else - echoerr 'Could not create backupdir ' . s:backupdir -endif diff --git a/vim/plugin/auto_swapdir.vim b/vim/plugin/auto_swapdir.vim deleted file mode 100644 index 2f9e6d25..00000000 --- a/vim/plugin/auto_swapdir.vim +++ /dev/null @@ -1,57 +0,0 @@ -" -" auto_swapdir.vim: Configure 'directory' automatically, including trying hard -" to create it. -" -" Author: Tom Ryder -" License: Same as Vim itself -" -if exists('g:loaded_auto_swapdir') || &compatible - finish -endif -let g:loaded_auto_swapdir = 1 - -" Define the swap path we want -if exists('$VIM_SWAPDIR') - let s:swapdir = $VIM_SWAPDIR -else - - " This is imperfect in that it will break if you have a backslashed comma in - " the first component of your &runtimepath, but if you're doing that, you - " probably already have way bigger problems - let s:swapdir - \ = strpart(&runtimepath, 0, stridx(&runtimepath, ',')) - \ . '/swap' -endif - -" If the prospective swapfile directory does not exist, try hard to create it -if !isdirectory(expand(s:swapdir)) - - " Try Vim's native mkdir() first - if exists('*mkdir') - silent! call mkdir(expand(s:swapdir), 'p', 0700) - - " Failing that, use an OS-dependent command - " (Fortunately, Unix and Windows are the only OS types in the world) - elseif has('*shellescape') - if has('unix') - let l:mkdir = '!mkdir -m 0700 -p ' - elseif has('win32') || has('win64') - let l:mkdir = '!mkdir ' - endif - silent! execute l:mkdir - \ . shellescape(expand(s:swapdir)) - endif - -endif - -" If the directory exists after that... -if isdirectory(expand(s:swapdir)) - - " Set the swapfile directory and turn swapfiles on - execute 'set directory^=' . s:swapdir . '//' - set swapfile - -" If not, give up and raise an error -else - echoerr 'Could not create swapdir ' . s:swapdir -endif diff --git a/vim/plugin/auto_undodir.vim b/vim/plugin/auto_undodir.vim deleted file mode 100644 index a38dce02..00000000 --- a/vim/plugin/auto_undodir.vim +++ /dev/null @@ -1,60 +0,0 @@ -" -" auto_undodir.vim: Configure 'undodir' automatically, including trying hard -" to create it. -" -" Author: Tom Ryder -" License: Same as Vim itself -" -if exists('g:loaded_auto_undodir') || &compatible - finish -endif -if !has('persistent_undo') - finish -endif -let g:loaded_auto_undodir = 1 - -" Define the undo path we want -if exists('$VIM_UNDODIR') - let s:undodir = $VIM_UNDODIR -else - - " This is imperfect in that it will break if you have a backslashed comma in - " the first component of your &runtimepath, but if you're doing that, you - " probably already have way bigger problems - let s:undodir - \ = strpart(&runtimepath, 0, stridx(&runtimepath, ',')) - \ . '/undo' -endif - -" If the prospective undo directory does not exist, try hard to create it -if !isdirectory(expand(s:undodir)) - - " Try Vim's native mkdir() first - if exists('*mkdir') - silent! call mkdir(expand(s:undodir), 'p', 0700) - - " Failing that, use an OS-dependent command - " (Fortunately, Unix and Windows are the only OS types in the world) - elseif has('*shellescape') - if has('unix') - let l:mkdir = '!mkdir -m 0700 -p ' - elseif has('win32') || has('win64') - let l:mkdir = '!mkdir ' - endif - silent! execute l:mkdir - \ . shellescape(expand(s:undodir)) - endif - -endif - -" If the directory exists after that... -if isdirectory(expand(s:undodir)) - - " Set the undo directory and turn persistent undo files on - execute 'set undodir^=' . s:undodir . '//' - set undofile - -" If not, give up and raise an error -else - echoerr 'Could not create undodir ' . s:undodir -endif -- cgit v1.2.3