Vim 的自动右括号 [英] Automatic closing brackets for Vim

查看:43
本文介绍了Vim 的自动右括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何适用于 Vim 7.4 的 WORKING 插件会自动关闭方括号('{}'、'[]'、'()')并可能插入一些回车符(至少对于 '{}')?

我知道这个问题已经被问过很多次了,但没有一个答案似乎在 vim 7.4 中不起作用,或者插件没有更新或其他什么.

到目前为止,我已经尝试了 vim-smartinput、autoclose 和 delimitmate,但这些都没有成功插入任何结束字符,即使我启用了插件,否则它们似乎处于活动状态.我不知道 vim 中是否有一些更改以某种方式破坏了这些插件.这些插件似乎至少在一年内都没有更新.任何适用于 vim 7.4 的可行解决方案?

解决方案

我正在回答我自己的问题,因为我发现为什么没有一个插件对我有用.问题似乎与 vim 中的 mksession 功能有关,我只是在保存的会话中尝试这些插件,并且出于某种原因似乎阻止了插件出于某种未知原因工作.插件似乎已安装并且工作"正常(如在插件中找到的命令等).不打开保存的会话至少 delimitMate 开始为我工作.

Is there any WORKING plugin for Vim 7.4 that would automatically close brackets ('{}', '[]', '()') and maybe insert some carriage returns (for '{}' at least)?

I know this question has been asked quite a few times but none of the answers either do not seem to work in vim 7.4 or the plugin has not been updated or something.

So far I've tried vim-smartinput, autoclose and delimitmate and NONE of these have managed to insert any closing characters even though I have enabled the plugins and they otherwise seem to be active. I don't know if there has been some changes in vim that somehow breaks these plugins. None of these plugins seem to be updated in a ~year at least. Any working solutions that would work with vim 7.4?

解决方案

I'm answering my own question because I figured out why none of the plugins seemed to work for me. It seems the problem is related to the mksession feature in vim, I was only trying out these plugins within a saved session and for some reason that seems to prevent the plugins from working for some unknown reason. The plugins seem to be installed and "working" fine (as in the commands from the plugin are found etc.). Without opening a saved session at least delimitMate started working for me.

这篇关于Vim 的自动右括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆