Vim 默认的 tabline 的实现是怎样的?功能?
在 Vim 中,形成屏幕顶部选项卡行的文本(使用选项卡时)是使用 tabline
选项配置的。
我想对默认选项卡页面行进行一些细微的调整,例如将选项卡中的窗口数量替换为选项卡的索引。不幸的是,它的默认版本(当 tabline
未设置时处于活动状态)很复杂并且没有文档记录。我没有什么可以调整的。
是否有一段 Vim 脚本提供了我可以根据需要进行调整的默认实现?
In Vim, the text that forms the row of tabs at the top of the screen (when using tabs) is configured with the tabline
option.
I'd like to make a few minor adjustments to the default tab pages line, such as replacing the number of windows in the tab with the index of the tab. Unfortunately, the default version of this (which is active when tabline
is unset) is complicated and undocumented. There's nothing for me to tweak.
Is there a piece of Vim script that provides the default implementation which I could adjust to my needs?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我使用自定义函数来重置选项卡编号和视口编号,来自 此处(请参阅 Tonymec 的评论)。您可以使用它来更改选项卡的显示方式。
这是我的
.vimrc
中的内容。这只是一个稍微修改的版本,改变了选项卡#和视口#的显示方式。这是我的函数中定义的颜色:
I use a custom function to reset the tab number and viewport numbers, from here (see Tonymec's comment). You can play with it to change how you display the tabs.
Here's what I have in my
.vimrc
. It's only a slightly modified version, that changes how the tab# and viewport# are displayed.And here are the colors defined in my function:
这不是您想要的答案,但我会与您分享我自己的表格。
在 wikia 页面的帮助下完成的,这是我的版本。
这是第一个选项卡中打开的三个窗口,其中两个窗口在一个编辑的文件上打开。
This is not the answer you are asking for but I will share my own tabline with you.
Did it with help from the wikia page, here is my version.
This is where the first tab has three windows open in it, with two open on one edited file.
尤达的解决方案是正确的。为了具体回答这个问题,
tabline
没有默认值。如果未设置,Vim 会自行构造显示行。实现位于 Vim 7.3 源代码的src/screen.c
的draw_tabline()
中。我希望在这里找到一个通过同一引擎运行的隐藏默认值,但遗憾的是它是纯 C 实现。让我想知道为什么他们不直接构造一个 tabline 值并使用引擎来解析它,而是在 CPU 周期计数的那一天写回 Vim,这当然要快一些。yoda's solution is the right one. To specifically answer the question, there is no default value for
tabline
. If it's not set, Vim constructs the displayed line itself. The implementation is insrc/screen.c
atdraw_tabline()
, in the Vim 7.3 source. I'd hoped to find a hidden default value in here that was run through the same engine, but alas it's a pure C implementation. Makes me wonder why they didn't just construct a tabline value and use the engine to parse it, but Vim was written back in the day when CPU cycles counted, and this is certainly slightly faster.