How to prepend characters to Vim backup file names?
backup, vim
Solution
One potential solution is to
mkdir ~/.vim/backup
and then add
set backupdir=~/.vim/backup
in your ~/.vimrc so that you don't have to look at them.
However if you want to keep them in the same directory you could rename them when you write them like this:
au BufWritePost * exe "silent !mv ".expand("%:p").&bex." ".expand("%:p:h")."/.".expand("%:t").&bex
Problem
By default, Vim appends a tilde `~` to backup files. I know there's a configuration option to customize the backup file extension: If you set `backupext=.bak` in your .vimrc file, your backup files will have `.bak` appended to them instead of a tilde. I'm wondering what's the best way to have Vim automatically prepend characters to the backup file name. Specifically, I'd like Vim to prepend a period `.` while continuing to append a tilde `~`. (If you're wondering why, I use KDE and don't like Dolphin to display backup files - see http://forum.kde.org/viewtopic.php?f=17&t=82350). I also looked at this thread, but I don't want to create a custom backups directory, I just want to prepend a character to the backup file name.