aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Overbruck <mail@duncano.de>2019-08-27 14:54:12 +0200
committerDuncan Overbruck <mail@duncano.de>2019-08-27 14:54:12 +0200
commite952fda21c936a774b074d78229cb20307b78bb7 (patch)
tree0ae1d55f55078fc6fb164eb0582792db6efae093
parent3abce905f8093098da49ca83b29af0a6ca5a6ef6 (diff)
downloaddotfiles-e952fda21c936a774b074d78229cb20307b78bb7.tar.gz
vim: create undo, swap and backup directories
-rw-r--r--config/vim/vimrc22
1 files changed, 17 insertions, 5 deletions
diff --git a/config/vim/vimrc b/config/vim/vimrc
index 93f96b8..855f455 100644
--- a/config/vim/vimrc
+++ b/config/vim/vimrc
@@ -7,9 +7,6 @@ endif
if empty($XDG_CONFIG_HOME)
let $XDG_CONFIG_HOME = fnamemodify("~/.config", ":p:h")
endif
-if empty($XDG_DATA_HOME)
- let $XDG_DATA_HOME = fnamemodify("~/.local/share", ":p:h")
-endif
" ============================================================================
" Basic settings
@@ -20,6 +17,8 @@ set shiftwidth=4
set autoread " automatically read changed files
+set viminfo+=n$XDG_CACHE_HOME/vim/viminfo
+
" syntax
syntax off " no syntax highlighting by default
sil! colorscheme shblah " default colorscheme
@@ -43,9 +42,22 @@ set completeopt=menuone,longest
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.db,*.o,*.a
" directories
-set undodir=$XDG_DATA_HOME/vim/undo//
-set backupdir=$XDG_DATA_HOME/vim/backup//
+"
+if !isdirectory($XDG_CACHE_HOME . "/vim/undo")
+ call mkdir($XDG_CACHE_HOME . "/vim/undo", "p")
+endif
+set undodir=$XDG_CACHE_HOME/vim/undo//
+
+if !isdirectory($XDG_CACHE_HOME . "/vim/backup")
+ call mkdir($XDG_CACHE_HOME . "/vim/backup", "p")
+endif
+set backupdir=$XDG_CACHE_HOME/vim/backup//
+
+if !isdirectory($XDG_CACHE_HOME . "/vim/swp")
+ call mkdir($XDG_CACHE_HOME . "/vim/swp", "p")
+endif
set directory=$XDG_CACHE_HOME/vim/swp//
+
let g:netrw_home=expand("$XDG_DATA_HOME/vim")
" histroy/undo