使用 a.vim 进行 C++
有没有办法使用 a.vim 插件在 .h、.cxx 和 .txx 文件之间切换?或者,您能提供另一种解决方案吗?这个想法是自动从 .h -> 切换。 .txx-> .cxx
在按下按键时。
非常感谢你们俩!
is there a way to use the a.vim plugin to switch between .h, .cxx and .txx files? Alternatively, can you provide another solution? The idea is to automagically switch from .h -> .txx -> .cxx
at the press of a key.
A Big Thanks to both of you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 a.vim 中查找包含
AddAlternateExtensionMapping
的行。第一个参数是当前文件的扩展名,第二个参数是您要使用:A
切换到的文件的扩展名列表。它们按优先顺序列出。就您而言,您必须对其进行设置,以便它能够循环运行。现在,如果存在,则从 .h 转到 .txx,如果不存在,则从 .cxx 转到。
Look for the lines in a.vim that contain
AddAlternateExtensionMapping
. The first argument is the extension of the current file, the second is a list of extensions of the file you'd like to switch to with:A
. They are listed in order of preference. In your case, you'd have to set it up so that it would go in a cycle.So now you go from .h to .txx if it exists or .cxx if it doesn't.
IIRC,在最新版本的alternate 中,有一个选项可以告诉您要使用的首选扩展。您查看过该插件的文档/第一条注释行吗?
IIRC, with the latest versions of alternate, there is an option that tells the preferred extensions to use. Did you have a look in the doc/first comment lines of the plugin?
a.vim 的一个有价值的替代品是 altr。
默认情况下,此插件允许您在“备用”Vim 脚本文件、C、C++ 和 Objective-C 文件以及 ASP.NET 文件之间切换,但您也可以轻松添加自己的备用文件。
设置您喜欢的映射
使用 Ex 命令以 a.vim 方式
<前><代码>命令!调用 altr#forward()
或使用映射
A worthy alternative to a.vim is altr.
By default this plugin lets you switch between "alternate" Vim script files, C, C++, and Objective-C files, and ASP.NET files, but you can easily add your own alternates too.
After installation, set up the mappings that you prefer,
either the a.vim way, using an Ex command
or using mappings