Closed sudoyang closed 3 years ago
I get it when entering and exiting 'insert' mode.
My current workaround is to only use this plugin in guimode by inlining it inside a check:
" inlined Plugin 'jeffkreeftmeijer/vim-numbertoggle', too many redraws in term
if has("gui_running")
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu | set rnu | endif
autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
augroup END
end
Maybe it's because gui redraws are more efficient?
A bit a go, I removed this plugin entirely and just have this in my vimrc.
set number relativenumber
And it does what I want and no flash.
Edit: It just doesn't switch to line numbers in insert mode.
Kache's method is pretty effective.
My snipped I found on the interwebs:
augroup toggleRelativeLineNumbers
autocmd!
autocmd InsertEnter,BufLeave,WinLeave,FocusLost * nested
\ if &l:number && empty(&buftype) |
\ setlocal norelativenumber |
\ endif
autocmd InsertLeave,BufEnter,WinEnter,FocusGained * nested
\ if &l:number && empty(&buftype) |
\ setlocal relativenumber |
\ endif
augroup END
I haven’t been able to reproduce this on the latest version in the latest neovim. Please reopen this issue with more information if you’re still running into this in almost-2021.
It seems that every toggle makes vim to redraw the whole interface so it flashes across the whole window. It works fine with older versions of vim but has this problem after a upgrade to 8.1.1681.
If :set rnu or :set nornu is typed manually, you can see how vim flashes. I guess it is the issue of vim itself.