Vim 中的 TextMate 评论横幅
我正在从 TextMate 切换到 Vim 来进行所有文本编辑。然而,我在 TextMate 中经常使用的功能之一是评论横幅命令 (ctr-shift-b
)。它将创建一个横幅并允许您在横幅内输入文本,并且横幅将根据文本的长度进行调整。 Vim 中有任何插件或类似功能吗?如果没有,有什么办法可以让 vim 制作一个评论横幅吗?任何建议都会很棒。谢谢!
I am making the switch from TextMate to Vim for all of my text editing. However, one of the features that I used a lot in TextMate was the comment banner command (ctr-shift-b
). It would create a banner and allow you to enter text inside the banner, and the banner would adjust to the length of the text. Is there any plugins, or any similiar feature in Vim? If not, is there a way I can program vim to make a comment banner? Any suggestions would be great. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的
.vimrc
中有这些行:在
.vimrc
中,它将 this: 变成这样:
在 JS 文件中,它把 this:
变成这样:
等等。
我希望不过,我会保留找到它的链接。
I've got these lines in my
.vimrc
:In
.vimrc
it turns this:into this:
In a JS file it turns this:
into this:
Etc.
I wish I'd keep a link to where I found it, though.
我目前使用 Snipmate.vim https://github.com/msanders/snipmate.vim
虽然我我不完全确定有一个片段可以满足您的确切需求,它会
添加一个就可以做到这一点是微不足道的!
它有非常简单的脚本来添加您需要的任何内容。
您必须为代码片段分配特定的组合键,这样当您在插入模式下使用该组合键并按 Tab 时,插件就会插入您需要的所有内容,并且可以让您更改之前设置的文本。
因此,对于您给出的示例,我会给它一个表示“横幅”的组合。当我输入该单词并点击 Tab 时,我将被放置在“评论横幅”中,以便我可以输入并替换标题。
这个网站有一个关于一切如何工作的非常好的视频:http://www. catonmat.net/blog/vim-plugins-snipmate-vim/
I currently use Snipmate.vim https://github.com/msanders/snipmate.vim
Although I am not completely sure there is a snippet that will match your exact need, it would
be trivial to add one that would do so!
It has very easy scripting to add whatever you need.
You would have to assign the snippet a certain key combination, so that when you are at that combination in insert mode and you hit Tab, the plugin inserts all the things you need plus it lets you change the text that you have previously set.
So for the example you give, I would give it a combination that says "banner". When I type that word and hit Tab, I would be placed in the "Comment Banner" so that I can type and replace the title.
This site has a very good video on how everything works: http://www.catonmat.net/blog/vim-plugins-snipmate-vim/