VIM:插入空液体标签的快捷方式?
我正在将我的博客迁移到 Jekyll 并使用 MacVim 来撰写我的帖子。我注意到我写的标签很多看起来像这样:
{% highlight bash %}
chmod -R g+w test
{% endhighlight %}
甚至...
{{ content }}
是否有插入 {{ }}
或 {% %}
的快捷方式标签?
注意:我对 Vim 还很陌生,所以非常感谢您的帮助。我安装了 Tim Pope 的 Liquid 插件 以及环绕插件。
I'm migrating my blog to Jekyll and using MacVim to write my posts. I notice that I'm writing tags that look like this a lot:
{% highlight bash %}
chmod -R g+w test
{% endhighlight %}
or even...
{{ content }}
Is there a shortcut to insert the {{ }}
or {% %}
tags?
Note: I'm fairly new to Vim so any help is appreciated. I have Tim Pope's Liquid plugin installed as well as the surround plugin.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能想看看 Tim Pope 的 ragtag。它为
{{ foo }}
提供了=
,为{% foo % 提供了
。-
等映射}如果您不想要ragtag,并且由于您已经安装了环绕声,您可能需要创建自己的映射。我建议您创建一个
~/.vim/after/ftplugin/liquid.vim
并输入以下内容:这将为- 就像 ragtag 一样。
=
和 < 创建环绕映射code>You may want to take a look at ragtag by Tim Pope. It provides mappings like
<c-x>=
for{{ foo }}
and<c-x>-
for{% foo %}
.If you do not want ragtag and since you have surround installed you may want to create your own mappings. I suggest you create a
~/.vim/after/ftplugin/liquid.vim
and put in the following:This will create surround mappings for
<c-s>=
and<c-s>-
just like ragtag.您始终可以使用键盘映射,例如
使用它,如果您在插入模式下键入 I{ ,它将插入
{{}}
然后切换回正常模式将光标移回然后第一个}
返回插入模式。华泰
You can always use keyboard maps, like
With it if you type I{ in insert mode it will insert
{{}}
then switches back to normal mode moves the cursor back to the 1st}
then goes to insert mode back.HTH