1
0
mirror of https://github.com/frebib/dotfiles.git synced 2024-06-14 12:57:23 +00:00

vim: only autosave for existing files

This commit is contained in:
Joe Groocock 2018-03-29 12:15:20 +01:00
parent 61ca5b014b
commit 5c8faae56d
Signed by: frebib
GPG Key ID: E0B16BEACFBB6A86

View File

@ -34,8 +34,13 @@ set scrolloff=6
set nojoinspaces set nojoinspaces
" Autosave settings " Autosave settings
function SaveIfExist()
if @% != "" && filereadable(@%)
write
endif
endfunction
set autowrite set autowrite
autocmd InsertLeave * save autocmd InsertLeave * call SaveIfExist()
" Search options " Search options
set hlsearch set hlsearch