vimrc: add func to refresh ui after sourcing vimrc

This commit is contained in:
surtur 2022-08-11 12:47:55 +02:00
parent acd1a835cd
commit ae92727871
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

@ -1002,8 +1002,30 @@ silent function! LINUX()
return has('unix') && !has('macunix') && !has('win32unix')
endfunction
" note: this might be outdated at this point, I am not sure.
" https://github.com/bling/vim-airline/issues/539
function! RefreshUI()
if exists(':AirlineRefresh')
AirlineRefresh
else
" Clear & redraw the screen, then redraw all statuslines.
redraw!
redrawstatus!
endif
endfunction
" from vim wiki
augroup autoReloadVimRC
autocmd!
" automatically reload vimrc when it's saved
autocmd BufWritePost ~/.vimrc so ~/.vimrc | call RefreshUI()
augroup END
" reload config
nnoremap <Leader>ve :e $MYVIMRC<CR>
nnoremap <Leader>vr :source $MYVIMRC<CR>
" reload config and call refresh fn
nnoremap <Leader>vr :source $MYVIMRC<CR>call RefreshUI()<CR>
" https://sw.kovidgoyal.net/kitty/faq/#using-a-color-theme-with-a-background-color-does-not-work-well-in-vim
" work wround vim's background colour erase