VIM + ctags 打开了太多烦人的缓冲区

发布于 2024-11-03 10:43:07 字数 368 浏览 6 评论 0原文

我通常一次只处理两个或三个文件,因此在将“Shift+H”映射到“:bn”后,我可以通过多次按“shift+H”在这些文件之间快速切换(我不必使用 :ls 加 :bn)。但是通过 ctags 的 ctrl+] 跳转到/返回函数的定义后,它会为新文件打开许多缓冲区(:ls 现在显示许多缓冲区)。现在,随着打开的缓冲区数量的增加,使用“Shift+H”(:bn) 重新定位到新文件的速度很慢。有什么想法吗?您有这些问题吗?是否可以隐藏由 ctags 引起的缓冲区,或者至少在代码从跳转返回时删除这些 ctags_caused 缓冲区?谢谢。

PS:我不喜欢用:ls查看要跳转的文件,然后用:bn切换文件的方式,因为我觉得按“shift+H”更方便快捷。

谢谢。

---彼得

I usually only works on two or three files at one time, so after mapping "Shift+H" to ":bn", I can quickly switch among these files by pressing "shift+H" several times (I don't have to use :ls plus :bn). But after jumping to/back the definitions of functions via ctags's ctrl+], it opens many buffers for new files (:ls now shows many buffers). Now as the number of opened buffers increases, it is slow to relocate to new files using "Shift+H"(:bn). Any ideas? Do you have these problems? Is it possible to hidden buffer caused by ctags or at least delete these ctags_caused buffers when code returning from jumping? Thanks.

PS: I don't like the way of using :ls to see the file you want to jump, then using:bn to switch files, since I think pressing "shift+H" is more convenient and faster.

Thanks.

---Peter

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抽个烟儿 2024-11-10 10:43:07

如果您使用 vim,那么使用制表符而不是缓冲区可能会解决问题。

您可以在单独的选项卡中打开两个或三个文件(:tabnew filename),并使用“gT”和“gt”普通命令在选项卡之间来回切换。

您可以将“shift+H”映射修改为“gT”或“gt”。

您还可以使用 ctrl+w ctrl+] 跳转到新窗口中的函数定义,以便您可以关闭新窗口并返回到包含您跳转的缓冲区的原始窗口。

同样相关的是,当我加载了许多缓冲区时,我通常依靠“:b”命令完成功能来根据我提供的部分文件名快速切换到我想要的缓冲区。

If you are using vim then using tabs instead of buffers may solve the problem.

You can open the two or three files in separate tabs (:tabnew filename), and use the 'gT' and 'gt' normal commands to switch back and forth between the tabs.

You can modify your "shift+H" mapping to either 'gT' or 'gt'.

You can also use ctrl+w ctrl+] to jump to function definition in a new window so that you can close the new window and go back to your original window containing the buffer that you jumped from.

Also related, when I have many buffers loaded I normally rely on the ":b" command completion's feature to quickly switch to the buffer that I want based on the partial filename that I give to it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文