0

Is there an option to control .cache folder location in Vim? Is there a setting or a variable for this?

  • Are you using Vim or Neovim? – Martin Tournoij Nov 8 '19 at 5:18
  • 2
    For what is Vim using that location; I'm not aware that it's used?! In general, the XDG_CACHE_HOME environment variable controls this. – Ingo Karkat Nov 8 '19 at 7:40
  • I am using Vim. – user1602 Nov 8 '19 at 8:19
  • 2
    You can try :let $XDG_CACHE_HOME = '...' in your ~/.vimrc. I'm still curious what kind of files Vim is placing there (and which you want moved elsewhere)? – Ingo Karkat Nov 8 '19 at 12:14
  • 2
    @IngoKarkat my money’s on a plugin or janus-like setup – D. Ben Knoble Nov 8 '19 at 12:51
1

This is one of the differences between Vim and Neovim. The latter supports XDG, the former doesn't. That being said, you can make Vim to respect XDG by manually setting some locations, but you have to decide what kind of stuff you want to put on $XDG_CONFIG_CACHE. For example you could put your .viminfo there: set viminfo+=n$XDG_CACHE_HOME/vim/viminfo. Also backups and swap files:

set directory=$XDG_CACHE_HOME/vim
set backupdir=$XDG_CACHE_HOME/vim

(Neovim consider these data, so they go in $XDG_DATA_HOME instead).

As a side note, to have all your configuration on $XDG_CONFIG_HOME you can use

set runtimepath=$XDG_CONFIG_HOME/vim,$XDG_CONFIG_HOME/vim/after,$VIM,$VIMRUNTIME
let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc"
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.