sponsor Vim development Vim logo Vim Book Ad

auto_cache_dirs.vim : Create and set cache file directories easily

 script karma  Rating 4/7, Downloaded by 675  Comments, bugs, improvements  Vim wiki

created by
Tom Ryder
 
script type
utility
 
description
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.

https://sanctum.geek.nz/cgit/vim-auto-cache-dirs.git
 
install details
Drop plugin/auto_cache_dirs.vim in your ~/.vim/plugin directory. Add doc/auto_cache_dirs.txt in ~/.vim/doc if you want the help file. Otherwise, use your favourite Vim plugin package manager.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-auto-cache-dirs-0.4.4.tar.gz 0.4.4 2018-09-06 6.0 Tom Ryder Delete stray file again
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github