I have set cursorline in my vimrc. Is there any way to make vim highlight only the current line in the active buffer instead of all buffers?
The problem with the BufEnter
/ BufLeave
hooks used in Zsolt's answer is that they don't fire when moving to an adjacent window that displays the same buffer. I have used the following successfully:
augroup CursorLine
au!
au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
au WinLeave * setlocal nocursorline
augroup END
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With