Add deletion of undodir files created by git commits

master
Louis Royer 5 years ago
parent c4ca70d5bd
commit 1c1491ce93

@ -2,7 +2,6 @@
if has("autocmd") if has("autocmd")
autocmd! bufwritepost .vimrc source ~/.vimrc autocmd! bufwritepost .vimrc source ~/.vimrc
endif endif
if !empty(system("setxkbmap -print|grep bepo")) if !empty(system("setxkbmap -print|grep bepo"))
source ~/.vimrc.bepo source ~/.vimrc.bepo
endif endif
@ -35,16 +34,24 @@ set modeline
" Maintain undo history between sessions " Maintain undo history between sessions
set undofile set undofile
if ($XDG_DATA_HOME != '') 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 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 else
if ($HOME != '') 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 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 else
echo "Error: environment variable $HOME not set" echo "Error: environment variable $HOME not set"
endif endif
endif endif
if has("autocmd")
if &term =~ "xterm\\|rxvt" if &term =~ "xterm\\|rxvt"
" use an orange cursor in insert mode " use an orange cursor in insert mode
let &t_SI = "\<Esc>]12;orange\x7" let &t_SI = "\<Esc>]12;orange\x7"
@ -55,10 +62,10 @@ if &term =~ "xterm\\|rxvt"
autocmd VimLeave * silent !echo -ne "\033]112\007" autocmd VimLeave * silent !echo -ne "\033]112\007"
" use \003]12;gray\007 for gnome-terminal and rxvt up to version 9.21 " use \003]12;gray\007 for gnome-terminal and rxvt up to version 9.21
endif endif
endif
" Colorise les nbsp " Colorise les nbsp
colorscheme koehler colorscheme koehler
highlight NbSp ctermbg=lightgray guibg=lightred highlight NbSp ctermbg=lightgray guibg=lightred
match NbSp /\%xa0/ match NbSp /\%xa0/

Loading…
Cancel
Save