From afd175d70294e36f0ff2d80d96bbd434b4a55d91 Mon Sep 17 00:00:00 2001 From: sev Date: Tue, 7 Nov 2023 09:08:13 -0600 Subject: [PATCH 1/1] vimrc: use XDG_STATE_HOME subdirs for all files --- etc/vim/.vimrc | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/etc/vim/.vimrc b/etc/vim/.vimrc index bad9f6a..9c1fd4c 100644 --- a/etc/vim/.vimrc +++ b/etc/vim/.vimrc @@ -1,26 +1,40 @@ source $VIMRUNTIME/defaults.vim -let x = ($XDG_CONFIG_HOME??($HOME."/.config"))."/vim" +let x = ($XDG_CONFIG_HOME??($HOME.'/.config')).'/vim' execute 'set runtimepath='.x.','.&runtimepath.','.x.'/after' execute 'set packpath='.x.','.&packpath.','.x.'/after' packadd matchit -let x = ($XDG_DATA_HOME??($HOME."/.local/share"))."/vim" +let x = ($XDG_STATE_HOME??($HOME.'/.local/state')).'/vim' if !isdirectory(x) - call mkdir(x, "p", 0700) + call mkdir(x, 'p', 0700) +endif +execute 'set viminfofile='.x.'/.viminfo' + +let y = x.'/swap' +if !isdirectory(y) + call mkdir(y, 'p', 0700) +endif +execute 'set directory='.y.'//' + +let y = x.'/backup' +if !isdirectory(y) + call mkdir(y, 'p', 0700) endif set backup -execute 'set backupdir='.x.'//' +execute 'set backupdir='.y.'//' set backupcopy=yes -let x = ($XDG_STATE_HOME??($HOME."/.local/state"))."/vim" -if !isdirectory(x) - call mkdir(x, "p", 0700) + +let y = x.'/undo' +if !isdirectory(y) + call mkdir(y, 'p', 0700) endif set undofile -execute 'set undodir='.x.'//' -execute 'set viminfofile='.x.'/.viminfo' +execute 'set undodir='.y.'//' + unlet x +unlet y set autoindent set colorcolumn=80 -- 2.47.0