From a4b155c6a486ab6f93975a20a9ce9c7de25b7730 Mon Sep 17 00:00:00 2001 From: Michael Campagnaro Date: Mon, 17 Jul 2017 12:38:17 -0400 Subject: [PATCH] Add a timestamp to vim backup files --- vimrc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vimrc b/vimrc index aff5989..3f2de31 100644 --- a/vimrc +++ b/vimrc @@ -193,10 +193,13 @@ endif set t_ti= t_te= " keep more context when scrolling off the end of a buffer set scrolloff=3 + " Store temporary files in a central spot set backup -set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp -set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp +set directory=$HOME/tmp " For swap files +set backupdir=$HOME/tmp +:au BufWritePre * let &bex = '.' . strftime("%Y-%m-%d-%T") . '.bak' + " allow backspacing over everything in insert mode set backspace=indent,eol,start " display incomplete commands