Support the XDG_STATE_HOME directory
It's a better place to store most of the stuff Vim wants to store lying around on the filesystem than XDG_CACHE_HOME, it turns out? I'm still keeping installed packages primarily in XDG_CACHE_HOME, since if that directory is blown away then the same packages just get reinstalled automatically and nothing particularly important is lost, but the other stuff doesn't really belong in there. Undo files, viminfo, and so on are definitely a good example of "state data that should be persisted between (application) restarts, but that is not important or portable enough to the user that it should be stored in XDG_DATA_HOME", so XDG_STATE_HOME is a fine place for them.
This commit is contained in:
parent
08990a8df5
commit
ad496a7745
2 changed files with 6 additions and 6 deletions
|
@ -71,14 +71,14 @@ else
|
|||
endif
|
||||
|
||||
for s:dir in ['backup', 'swap', 'undo']
|
||||
call s:ensure_dir($XDG_CACHE_HOME . '/vim/' . s:dir)
|
||||
call s:ensure_dir($XDG_STATE_HOME . '/vim/' . s:dir)
|
||||
endfor
|
||||
|
||||
set backupdir=.,$XDG_CACHE_HOME/vim/backup
|
||||
set directory=.,$XDG_CACHE_HOME/vim/swap
|
||||
set backupdir=.,$XDG_STATE_HOME/vim/backup
|
||||
set directory=.,$XDG_STATE_HOME/vim/swap
|
||||
if exists('+undofile')
|
||||
set undofile
|
||||
set undodir=$XDG_CACHE_HOME/vim/undo
|
||||
set undodir=$XDG_STATE_HOME/vim/undo
|
||||
endif
|
||||
|
||||
let g:airline_powerline_fonts = 1
|
||||
|
|
4
vimrc
4
vimrc
|
@ -1,11 +1,11 @@
|
|||
for [s:var, s:value] in items({'XDG_CONFIG_HOME': '~/.config', 'XDG_CACHE_HOME': '~/.cache', 'XDG_DATA_HOME': '~/.local/share'})
|
||||
for [s:var, s:value] in items({'XDG_CONFIG_HOME': '~/.config', 'XDG_CACHE_HOME': '~/.cache', 'XDG_DATA_HOME': '~/.local/share', 'XDG_STATE_HOME': '~/.local/state'})
|
||||
if (empty(eval('$' . s:var)))
|
||||
exec 'let $' . s:var . ' = expand(s:value)'
|
||||
endif
|
||||
endfor
|
||||
|
||||
set runtimepath=$XDG_CONFIG_HOME/vim,$XDG_CACHE_HOME/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$XDG_CONFIG_HOME/vim/after,$XDG_CACHE_HOME/vim/after
|
||||
set viminfo+=n$XDG_CACHE_HOME/vim/viminfo
|
||||
set viminfo+=n$XDG_STATE_HOME/vim/viminfo
|
||||
if exists('+packpath')
|
||||
set packpath^=$XDG_CONFIG_HOME/vim,$XDG_CACHE_HOME/vim
|
||||
endif
|
||||
|
|
Loading…
Reference in a new issue