简体   繁体   English

在Vim的TagBar插件中,自动设置光标线

[英]In TagBar plugin in Vim, automatically set cursorline

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). 问题非常简单,当我运行TagbarToggle时,我希望该窗口中的cursorline选项为True(如果它在“主”窗口中)。

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. 当然,我每次都可以手动设置它,但这不是Vim的方法。

It looks like TagBar sets its own FileType : tagbar , this could be used in an autocmd : 看起来 TagBar设置了自己的FileTypetagbar ,可以在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. 另一种选择是为TagBar自己的语法组设置自定义突出显示,使其符合您的需求, 如文档所示。

I managed to fix it, for some reason TagBar sets nocursorline in the initWindow() function I simply replaced it with cul. 我设法修复它,由于某种原因,TagBar在initWindow()函数中设置了nocursorline,我只是将其替换为cul。 And now everything is working as it should. 现在一切正常。

But why would he set nocursorline? 但是他为什么要设置nocursorline?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM