I've been doing edit-save-run-bugfix-repeat on a Python test script, using
vim as my editor. My directory now looks like this:
-rwxrwxr-x 1 james james 458 Nov 29 23:02 test.pr~* -rwxrwxr-x 1 james james 504 Nov 29 22:53 test.ps~* -rwxrwxr-x 1 james james 485 Nov 29 22:51 test.pt~* -rwxrwxr-x 1 james james 503 Nov 29 22:48 test.pu~* -rwxrwxr-x 1 james james 504 Nov 29 22:48 test.pv~* -rwxrwxr-x 1 james james 485 Nov 29 22:40 test.pw~* -rwxrwxr-x 1 james james 262 Nov 29 22:36 test.px~* -rwxrwxr-x 1 james james 456 Nov 29 23:04 test.py* -rwxrwxr-x 1 james james 96 Nov 28 22:29 test.py~* -rwxrwxr-x 1 james james 109 Nov 29 22:20 test.pz~*
I was only expecting to see
test.py. I'm guessing it was
vim that did this, as they appear to be backups of the file taken at various stages of editing. But why?
Edit: here is my
" My Vim config file " The directory setting is a comma separated list of directories where " vim should place swapfiles. Each path is tried in order and the first " one that doesn’t fail (because it doesn’t exist or for permissions " reasons) is where vim will create swapfiles. By default on unix " systems, it it set to “.,~/tmp,/var/tmp,/tmp” which means it first " tries “.” or the same directory as the file being edited. By using ^=, " we tell vim to prepend the given value to those already set (the " defaults). This allows vim to fall back to other directories should " the specified one fail for some reason (directory doesn’t exist or " disk is full for example). The double slash at the end tells vim to " form swap file names using the full path of the edited file, replacing " / with %, avoiding name conflicts. See :help directory for more " details. set directory^=$HOME/.vim_swap// set background=dark set tw=120 au BufRead *.sh,*.py set tw=0 au BufRead *.txt set tw=80 syntax on filetype on filetype plugin on filetype indent on inoremap <F5> <C-R>=strftime("%Y-%m-%d %H:%M")<CR> set hlsearch set incsearch set expandtab set softtabstop=4 set shiftwidth=4 "highlight OverLength ctermbg=red ctermfg=white guibg=#592929 "match OverLength /\%81v.*/ "Tell vim to remember certain things when we exit " '10 : marks will be remembered for up to 10 previously edited files " "100 : will save up to 100 lines for each register " :20 : up to 20 lines of command-line history will be remembered " % : saves and restores the buffer list " n... : where to save the viminfo files set viminfo='10,\"100,:20,%,n~/.viminfo function! ResCur() if line("'\"") <= line("$") normal! g`" return 1 endif endfunction augroup resCur autocmd! autocmd BufWinEnter * call ResCur() augroup END set cm=blowfish " default is zip; insecure.