如何让帮助窗口始终在同一位置打开?
我这样做是为了在垂直窗口中打开帮助页面:
cabbrev help vert botright help
这样,可以,但有点令人不安,而且它也有点垃圾邮件我的 :history
。 我想让 Vim 不扩展它,只运行命令。因此,当我编写 :help topic
时,我希望它不展开,而是运行命令 :vert botright help topic
我尝试过
cabbrev <silent> help vert botright help
但它不起作用。
有可能做到吗?
I do this for opening help pages in vertical window:
cabbrev help vert botright help
this way, it is ok, but a bit disturbing, and it is spamming my :history
a bit too.
I would like to get Vim to not expand this, just run the command. So when I write :help topic
I want it to not expanded, but to run the command :vert botright help topic
I tried with
cabbrev <silent> help vert botright help
but it doesn't work.
Is it possible to do at all?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我根据这封电子邮件找到了完美的解决方案:
http://vim.1045645.n5.nabble.com/Horizontal-layout-by-default-td1164876.html#a1164886
因此,如果您希望帮助窗口位于右侧,请执行以下操作:
这会将
'help'
类型窗口立即置于右侧,就像CTRL-WH
一样。请参阅 vim 中的:h CTRL-W_H
。如果您启用了隐藏选项,则使用
:q
关闭窗口不会卸载帮助窗口缓冲区,并且如果您想打开它,则存在一个小问题同样,由于某种原因,它不会触发 FileType 事件(为什么?),因此,如果您使用:set hide
您需要:获取帮助窗口卸载,无论如何,这是默认行为。
I found the perfect solution based on this e-mail:
http://vim.1045645.n5.nabble.com/Horizontal-layout-by-default-td1164876.html#a1164886
So if you want help windows on the right, do this:
this puts the
'help'
type windows immediately to the right just likeCTRL-W H
. See:h CTRL-W_H
in vim.The small problem with it if you have the
hidden
option enabled, just closing the window with:q
doesn't unload the help window buffer, and if you want to open it again, it will not trigger the FileType event for some reason (why?), so if you use:set hidden
you need to:to get help windows unload, which is the default behavior anyway.
它只会在您按另一个键(例如空格)后展开,
也许您可以做到
然后养成快速说
:he
的习惯空格Enter 或实际上这将扩展为完整命令
编辑
如果您根本不想扩展,我建议使用自定义命令:
It will only expand after you press another key (e.g. Space)
Perhaps you can make it
And then make it a habit to quickly say
:he
SpaceEnter or indeedWhich will then expand to the full command
Edit
If you don't want the expansion at all, I suggest a custom command:
尽管您的答案可以在同一窗口上查看两个帮助主题(例如:
:h bar | h foo
),但在不同窗口上查看两个条目并不是最佳选择(例如:h foo | sp | wincmd w | h bar
),即使您的显示器只能显示两个 80 列窗口,它也会在第二个窗口上执行wincmd
。将以下行添加到
~/.vim/ftplugin/help.vim
中,仅当有空间进行另一个垂直分割时才执行wincmd
。Although your answer works to see two help topics on the same window (e.g.:
:h bar | h foo
), it is not optimal to see two entries on different windows (e.g.:h foo | sp | wincmd w | h bar
), as it executes also executes thewincmd
on the second window thus leaving three vertical windows, even if your monitor can display only two 80 columns windows.Adding the following lines to
~/.vim/ftplugin/help.vim
executes thewincmd
only when there is room for another vertical split.