Reputation: 1502
I'm getting pretty annoyed of vim automatically generating swap files when I press control-z. Is there any way to disable this feature (and not just delete them)?
Upvotes: 0
Views: 411
Reputation: 1397
Put this in your .vimrc:
set noswapfile
Edit: You could also consider moving backup files to a location where they won't get in your way. I have this in my .vimrc:
set noswapfile
" Alternatively, store your swap files in your local .vim folder
" call system('mkdir ~/.vim/swap')
" set dir=~/.vim/swap/
if has('persistent_undo')
set undolevels=5000
call system('mkdir ~/.vim/undo')
set undodir=~/.vim/undo
set undofile
endif
call system('mkdir ~/.vim/backups')
set backupdir=~/.vim/backups/
" The 'n' here is a prefix specifying which viminfo property is being set -
" in this case, the Name of the viminfo file.
" :h 'viminfo'
set viminfo+=n~/.vim/viminfo
I really like the persistent undo, meaning even after quitting vim, restarting the computer etc., you can just undo/redo changes from previous sessions.
Note that if you are using both console vim under Cygwin and windows gvim, you'll need to wrap all of this in an if v:progname != "gvim.exe"
block, since windows won't understand paths like ~/.vim
. I have this section duplicated in my _gvim file using windows paths, for the odd occasion where I use gvim.
Upvotes: 1