mirror of
https://github.com/frebib/dotfiles.git
synced 2024-06-14 12:57:23 +00:00
vim: autosave modified files, also when FocusGained
This commit is contained in:
parent
fc256a3f4f
commit
f35e8b8bec
@ -39,12 +39,12 @@ let mapleader="\<space>"
|
|||||||
|
|
||||||
" Autosave settings
|
" Autosave settings
|
||||||
function! SaveIfExist()
|
function! SaveIfExist()
|
||||||
if @% != "" && filereadable(@%) && !&readonly
|
if @% != "" && filereadable(@%) && !&readonly && &modified
|
||||||
write
|
write
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
set autowrite
|
set autowrite
|
||||||
autocmd CursorHold,CursorHoldI,InsertLeave,FocusLost * call SaveIfExist()
|
autocmd CursorHold,CursorHoldI,InsertLeave,FocusGained,FocusLost * call SaveIfExist()
|
||||||
|
|
||||||
" Search options
|
" Search options
|
||||||
set hlsearch
|
set hlsearch
|
||||||
|
Loading…
Reference in New Issue
Block a user