Vimrc 设置来模拟 Sublime 的括号自动完成 [英] Vimrc settings to emulate Sublime's parenthesis auto-completion

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

问题描述

如何在 vim 上为花括号 {} 模拟 Sublime 文本的自动完成行为?基本上,当一个括号被打开时,它应该在同一行自动关闭,当 被按下时,光标应该使用块缩进和 } 应该与包含 { 的行的原始缩进一致.如果我的问题不清楚,这是大多数代码编辑器在处理 {} 时的默认行为.

How do I emulate Sublime text's auto complete behavior for curly braces {} on vim? Basically, when a parenthesis is opened, it should auto close in the same line, and when <CR> is pressed the cursor should go to the next line with a block indentation and } should fall in line with the original indention of the line containing the {. If my question is not clear, this is the default behavior of most code editors when dealing with {}.

推荐答案

自动附加结束字符 Vim Tips Wiki 上的页面包含从简单映射到完整插件解决方案的所有内容.不过,最新的 Vim 7.4 版本似乎存在问题.

The Automatically append closing characters page on the Vim Tips Wiki has everything from simplistic mappings to complete plugin solutions. There seem to be issues with the latest Vim 7.4 version, though.

这篇关于Vimrc 设置来模拟 Sublime 的括号自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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