aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-12-26 17:24:08 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-12-26 17:24:08 +1300
commitd43717bbc761ee7c1d747621af712282f6aaf5e7 (patch)
tree4ff507af1f0a9ba2028a562eb4b8270bfa21410d
parentMerge branch 'hotfix/v3.6.1' into develop (diff)
downloaddotfiles-d43717bbc761ee7c1d747621af712282f6aaf5e7.tar.gz
dotfiles-d43717bbc761ee7c1d747621af712282f6aaf5e7.zip
Factor out vimrc user 'runtimepath' switching
-rw-r--r--vim/vimrc27
1 files changed, 12 insertions, 15 deletions
diff --git a/vim/vimrc b/vim/vimrc
index 69f63083..9ab03c51 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -4,6 +4,15 @@
" Undo anything the operating system's vimrc may have broken
runtime system.vim
+" Set an environment variable for the user runtime directory
+if !exists('$MYVIMRUNTIME')
+ if has('win32') || has('win64')
+ let $MYVIMRUNTIME = expand('~/vimfiles')
+ else
+ let $MYVIMRUNTIME = expand('~/.vim')
+ endif
+endif
+
" Load filetype settings, plugins, and maps
if has('autocmd')
let g:maplocalleader = ','
@@ -49,11 +58,7 @@ set backspace+=start " The start of current insertion
" Try to keep backups in one system-appropriate dir
set backup
-if has('win32') || has('win64')
- set backupdir^=~/vimfiles/cache/backup
-else
- set backupdir^=~/.vim/cache/backup
-endif
+set backupdir^=$MYVIMRUNTIME/cache/backup
" Add some paths not to back up
if has('unix')
@@ -79,11 +84,7 @@ endif
set confirm
" Try to keep swapfiles in one system-appropriate dir
-if has('win32') || has('win64')
- set directory^=~/vimfiles/cache/swap//
-else
- set directory^=~/.vim/cache/swap//
-endif
+set directory^=$MYVIMRUNTIME/cache/swap//
" Use UTF-8 if we can and env LANG didn't tell us not to
if has('multi_byte') && !exists('$LANG') && &encoding ==# 'latin1'
@@ -198,11 +199,7 @@ endif
" Keep undo files, hopefully in a dedicated directory
if has('persistent_undo')
set undofile
- if has('win32') || has('win64')
- set undodir^=~/vimfiles/cache/undo//
- else
- set undodir^=~/.vim/cache/undo//
- endif
+ set undodir^=$MYVIMRUNTIME/cache/undo//
endif
" Wildmenu settings; see also plugin/wildignore.vim