auto_cache_dirs.vim
This plugin attempts to intelligently set and create the directories for the
'backupdir'
, 'directory'
, and 'undodir'
options in a sensible root
location. It chooses the root directory by trying each of these in succession:
- If
g:auto_cache_dirs_root
is set when the plugin loads, it uses that. - If the environment variable
$XDG_CONFIG_HOME
is set, it uses that, with "/vim" appended. - If the system is Unix, it uses
~/.cache/vim
. - Otherwise, it uses the first element of the value of
'runtimepath'
.
The plugin tries hard to create the directories, trying Vim's native mkdir()
function if available first, and falling back to shell commands otherwise. At
the time of writing, the latter only works for Unix and Windows. If you use
another system and would like to see a routine for it added, please send a
patch through.
If the directory can be created, it sets the relevant option feature flag and prepends the path to that option path list.
If the directory cannot be created, a warning is printed, and the options as the plugin found them are left untouched.
License
Copyright (c) Tom Ryder. Distributed under the same terms as Vim itself.
See :help license
.