diff --git a/cfg/09-file-options.vim b/cfg/09-file-options.vim new file mode 100644 index 0000000..1b3841a --- /dev/null +++ b/cfg/09-file-options.vim @@ -0,0 +1,4 @@ +" By default, keep undo history and use swap files, but don't use backups. +set undofile +set swapfile +set nobackup diff --git a/cfg/10-runtime-files.vim b/cfg/10-runtime-files.vim new file mode 100644 index 0000000..732cf55 --- /dev/null +++ b/cfg/10-runtime-files.vim @@ -0,0 +1,41 @@ +" viminfo file +if &g:viminfo !~ ",n" + let s:viminfo_path = GetVardataPath( "viminfo" ) + let &g:viminfo = &g:viminfo . ",n" . s:viminfo_path + if filereadable( s:viminfo_path ) + rviminfo + endif +endif + +" Undo file, if active +if &g:undofile + let s:undo_path = GetVardataPath( "undo" ) + if CreateDirectoryIfNecessary( s:undo_path ) + let &g:undodir = s:undo_path + else + echoerr "could not create " . s:undo_path + set noundodir + endif +endif + +" Swap directory +if &g:swapfile + let s:swap_path = GetVardataPath( "swap" ) + if CreateDirectoryIfNecessary( s:swap_path ) + let &g:directory = s:swap_path + else + echoerr "could not create " . s:swap_path + set noswapfile + endif +endif + +" Backup directory +if &g:backup + let s:backup_path = GetVardataPath( "backup" ) + if CreateDirectoryIfNecessary( s:backup_path ) + let &g:backupdir = s:backup_path + else + echoerr "could not create " . s:backup_path + set nobackup + endif +endif