在 Emacs 中自动关闭大括号? [英] Automatically closing braces in Emacs?

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

问题描述

我见过一个 Vim 插件,名为 AutoClose(发现自这个post) 会在键入 '(', '{' 等时自动添加右大括号.

I've seen a plugin for Vim called AutoClose (discovered from this post) which automatically adds the closing brace when typing '(', '{' etc.

例如;当我输入以下内容时(| 是光标):

For example; when I type the following ( | is the cursor):

int main(|

我希望为我自动插入结束的 ):

I would like the closing ) to be inserted automatically for me:

int main(|)

有谁知道 emacs 有类似的功能 - Google 这次让我失望了!

Does anyone know of a similar feature for emacs - Google has failed me this time!

推荐答案

还有 'paredit.备忘单 向您展示了所有可用的命令.碰巧比另一个答案中建议的电动模式更喜欢它.虽然paredit只适用于(),所以可能不能满足你的需求.

There's also 'paredit. The cheat sheet shows you all the commands available. happen to like it better than the electric mode suggested in another answer. Though paredit does only apply to (), so it may not meed your needs.

但是,老实说,括号周围有一堆包.wiki 将它们全部列在此处.解决您问题的模式是:

But, to be honest, there's a bunch of packages surrounding parenthesis. The wiki has them all listed here. The modes addressing your question are:

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

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