Permalink
Browse files

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.
  • Loading branch information...
1 parent 3d53a2b commit 7e37213cfcebf1b2884f2a9fcd6e2ba6c1e090f9 @sbennett18 sbennett18 committed Jan 3, 2013
Showing with 18 additions and 5 deletions.
  1. +1 −1 .gitignore
  2. +17 −4 .vimrc
View
2 .gitignore
@@ -1,4 +1,4 @@
.DS_Store
*.pyc
*._*
-.vim/bundle
+.vim/
View
21 .vimrc
@@ -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()
+" }

1 comment on commit 7e37213

@xiangrikuidehuayu

擐甲挥戈赶快回家

Please sign in to comment.