mirror of
https://github.com/frebib/dotfiles.git
synced 2024-06-14 12:57:23 +00:00
vim: improve autosave events, fix re-sourcing
This commit is contained in:
parent
6129bb6794
commit
9a37bbb4c1
@ -32,15 +32,16 @@ set autoread
|
|||||||
set showmatch
|
set showmatch
|
||||||
set scrolloff=6
|
set scrolloff=6
|
||||||
set nojoinspaces
|
set nojoinspaces
|
||||||
|
set updatetime=500 " reduce delay from 4s default
|
||||||
|
|
||||||
" Autosave settings
|
" Autosave settings
|
||||||
function SaveIfExist()
|
function! SaveIfExist()
|
||||||
if @% != "" && filereadable(@%)
|
if @% != "" && filereadable(@%) && !&readonly
|
||||||
write
|
write
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
set autowrite
|
set autowrite
|
||||||
autocmd InsertLeave * call SaveIfExist()
|
autocmd CursorHold,CursorHoldI,InsertLeave,FocusLost * call SaveIfExist()
|
||||||
|
|
||||||
" Search options
|
" Search options
|
||||||
set hlsearch
|
set hlsearch
|
||||||
@ -233,10 +234,10 @@ endif
|
|||||||
|
|
||||||
" Save aliases.
|
" Save aliases.
|
||||||
noremap <Leader>q :wq<CR>
|
noremap <Leader>q :wq<CR>
|
||||||
com W w
|
com! W w
|
||||||
com Q q
|
com! Q q
|
||||||
com Wq wq
|
com! Wq wq
|
||||||
com WQ wq
|
com! WQ wq
|
||||||
" Write with sudo
|
" Write with sudo
|
||||||
cmap w!! w !sudo tee > /dev/null %
|
cmap w!! w !sudo tee > /dev/null %
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user