Customizable backup/swap/undo/views location

This was done in an effort to clean up the home directory and to
maintain a more centralized location for all vim related files that are
not touched often.
This commit is contained in:
Stephen Bennett 2013-01-03 13:27:12 -07:00
parent 3d53a2bf96
commit 7e37213cfc
2 changed files with 18 additions and 5 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
.DS_Store
*.pyc
*._*
.vim/bundle
.vim/

21
.vimrc
View File

@ -551,9 +551,8 @@ com! -nargs=+ UnBundle
\ call UnBundle(<args>)
function! InitializeDirectories()
let separator = "."
let parent = $HOME
let prefix = '.vim'
let prefix = 'vim'
let dir_list = {
\ 'backup': 'backupdir',
\ 'views': 'viewdir',
@ -563,8 +562,19 @@ function! InitializeDirectories()
let dir_list['undo'] = 'undodir'
endif
" To specify a different directory in which to place the vimbackup,
" vimviews, vimundo, and vimswap files/directories, add the following to
" your .vimrc.local file:
" let g:spf13_consolidated_directory = <full path to desired directory>
" eg: let g:spf13_consolidated_directory = $HOME . '/.vim/'
if exists('g:spf13_consolidated_directory')
let common_dir = g:spf13_consolidated_directory . prefix
else
let common_dir = parent . '/.' . prefix
endif
for [dirname, settingname] in items(dir_list)
let directory = parent . '/' . prefix . dirname . "/"
let directory = common_dir . dirname . '/'
if exists("*mkdir")
if !isdirectory(directory)
call mkdir(directory)
@ -579,7 +589,6 @@ function! InitializeDirectories()
endif
endfor
endfunction
call InitializeDirectories()
function! NERDTreeInitAsNeeded()
redir => bufoutput
@ -632,3 +641,7 @@ endfunction
endif
endif
" }
" Finish local initializations {
call InitializeDirectories()
" }