Skip to content

Commit

Permalink
Customizable backup/swap/undo/views location
Browse files Browse the repository at this point in the history
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
sbennett18 committed Jan 5, 2013
1 parent 3d53a2b commit 7e37213
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,4 +1,4 @@
.DS_Store .DS_Store
*.pyc *.pyc
*._* *._*
.vim/bundle .vim/
21 changes: 17 additions & 4 deletions .vimrc
Expand Up @@ -551,9 +551,8 @@ com! -nargs=+ UnBundle
\ call UnBundle(<args>) \ call UnBundle(<args>)


function! InitializeDirectories() function! InitializeDirectories()
let separator = "."
let parent = $HOME let parent = $HOME
let prefix = '.vim' let prefix = 'vim'
let dir_list = { let dir_list = {
\ 'backup': 'backupdir', \ 'backup': 'backupdir',
\ 'views': 'viewdir', \ 'views': 'viewdir',
Expand All @@ -563,8 +562,19 @@ function! InitializeDirectories()
let dir_list['undo'] = 'undodir' let dir_list['undo'] = 'undodir'
endif 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) for [dirname, settingname] in items(dir_list)
let directory = parent . '/' . prefix . dirname . "/" let directory = common_dir . dirname . '/'
if exists("*mkdir") if exists("*mkdir")
if !isdirectory(directory) if !isdirectory(directory)
call mkdir(directory) call mkdir(directory)
Expand All @@ -579,7 +589,6 @@ function! InitializeDirectories()
endif endif
endfor endfor
endfunction endfunction
call InitializeDirectories()


function! NERDTreeInitAsNeeded() function! NERDTreeInitAsNeeded()
redir => bufoutput redir => bufoutput
Expand Down Expand Up @@ -632,3 +641,7 @@ endfunction
endif endif
endif endif
" } " }

" Finish local initializations {
call InitializeDirectories()
" }

1 comment on commit 7e37213

@xiangrikuidehuayu
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

擐甲挥戈赶快回家

Please sign in to comment.