In TagBar plugin in Vim, automatically set cursorline

658 Views Asked by At

The question is really simple, when i run TagbarToggle i want the cursorline option to be True in that window (if it is in the "main" window).

something like:

if &cursorline
    call set_cursorline_in_tagbar()
endif

Of course i could just set it manually every time, but that's just not the Vim way.

2

There are 2 best solutions below

1
On

It looks like TagBar sets its own FileType: tagbar, this could be used in an autocmd:

autocmd FileType tagbar setlocal cursorline

Another option would be to set a custom highlighting for TagBar's own syntax groups that fits your need, as shown in the documentation.

1
On

I managed to fix it, for some reason TagBar sets nocursorline in the initWindow() function I simply replaced it with cul. And now everything is working as it should.

But why would he set nocursorline?