Add deletion of undodir files created by git commits

This commit is contained in:
Louis Royer 2019-09-06 15:41:34 +02:00
parent c4ca70d5bd
commit 1c1491ce93

View File

@ -2,7 +2,6 @@
if has("autocmd")
autocmd! bufwritepost .vimrc source ~/.vimrc
endif
if !empty(system("setxkbmap -print|grep bepo"))
source ~/.vimrc.bepo
endif
@ -35,25 +34,34 @@ set modeline
" Maintain undo history between sessions
set undofile
if ($XDG_DATA_HOME != '')
silent !mkdir $XDG_DATA_HOME/vim/undodir -p > /dev/null 2>&1
silent !mkdir $XDG_DATA_HOME/vim/undodir -p > /dev/null
set undodir=$XDG_DATA_HOME/vim/undodir
if has("autocmd")
autocmd bufwritepost * silent ! chmod" 600 $XDG_DATA_HOME/vim/undodir/* > /dev/null && rm $XDG_DATA_HOME/vim/undodir/*\%.git\%COMMIT_EDITMSG > /dev/null
endif
else
if ($HOME != '')
silent !mkdir $HOME/.local/share/vim/undodir -p > /dev/null 2>&1
silent !mkdir $HOME/.local/share/vim/undodir -p > /dev/null
set undodir=$HOME/.local/share/vim/undodir
if has("autocmd")
autocmd bufwritepost * silent ! chmod 600 $HOME/.local/share/vim/undodir/* > /dev/null && rm $HOME/.local/share/vim/undodir/*\%.git\%COMMIT_EDITMSG > /dev/null
endif
else
echo "Error: environment variable $HOME not set"
endif
endif
if &term =~ "xterm\\|rxvt"
" use an orange cursor in insert mode
let &t_SI = "\<Esc>]12;orange\x7"
" use a red cursor otherwise
let &t_EI = "\<Esc>]12;red\x7"
silent !echo -ne "\033]12;red\007"
" reset cursor when vim exits
autocmd VimLeave * silent !echo -ne "\033]112\007"
" use \003]12;gray\007 for gnome-terminal and rxvt up to version 9.21
if has("autocmd")
if &term =~ "xterm\\|rxvt"
" use an orange cursor in insert mode
let &t_SI = "\<Esc>]12;orange\x7"
" use a red cursor otherwise
let &t_EI = "\<Esc>]12;red\x7"
silent !echo -ne "\033]12;red\007"
" reset cursor when vim exits
autocmd VimLeave * silent !echo -ne "\033]112\007"
" use \003]12;gray\007 for gnome-terminal and rxvt up to version 9.21
endif
endif
" Colorise les nbsp
@ -61,4 +69,3 @@ colorscheme koehler
highlight NbSp ctermbg=lightgray guibg=lightred
match NbSp /\%xa0/