Emacs的typeover骨架对插入,也许 [英] Emacs typeover skeleton-pair-insert-maybe

查看:70
本文介绍了Emacs的typeover骨架对插入,也许的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Eclipse中,编辑Java代码,如果我键入一个开放的括号,我得到一对括号中。如果我那么第二个括号直通式,它不会插入额外的括号。我如何获得在Emacs的?

In Eclipse, editing Java code, if I type an open-paren, I get a pair of parens. If I then "type through" the second paren, it does not insert an additional paren. How do I get that in emacs?

在Eclipse编辑器是足够聪明,知道,当我键入近距离括号,那我刚刚完成我的开始。光标过去进步的密切括号。如果我再键入一个分号,同样的事情:它只是覆盖过去分号,而我不明白其中的两个。

The Eclipse editor is smart enough to know, when I type the close-paren, that I am just finishing what I started. The cursor advances past the close paren. If I then type a semicolon, same thing: it just overwrites past the semicolon, and I don't get two of them.

在Emacs中,在Java模式或csharp模式,如果我绑定开放括号为骨架对插入,也许,我得到一个开闭括号对,这是很好的。不过,如果I型到结束括号,我得到两个近距离的括号。

In emacs, in java-mode, or csharp-mode if I bind open-paren to skeleton-pair-insert-maybe, I get an open-close paren pair, which is good. But then if I "type through" the close paren, I get two close-parens.

有没有办法教的Emacs的前一骨架对插入,也许以后不会插入右括号?如果这是可能的,什么样的一些类似的情报,以避免分号加倍?

Is there a way to teach emacs to not insert the close paren after an immediately preceding skeleton-pair-insert-maybe? And if that is possible, what about some similar intelligence to avoid doubling the semicolon?

我问括号,但同样适用于双引号,大括号,括号等任何插入骨架对插入,也许。

I'm asking about parens, but the same applies to double-quotes, curly braces, square brackets, etc. Anything inserted with skeleton-pair-insert-maybe.

推荐答案

这个帖子显示了如何做你想要的。作为奖励,还说明了如何设置它,因此,如果您开字符后,立即退格键,它也将删除光标后关闭字符

This post shows how to do what you want. As a bonus it also shows how to set it up so that if you immediately backspace after the opening char, it will also delete the closing char after the cursor.

更新:

由于我张贴了这个答案,我发现的 Autopair 这是一个非常适合这个用例系统。我已经使用了很多,爱它了。

Since I posted this answer, I've discovered Autopair which is a pretty much perfect system for this use case. I've been using it a lot and loving it.

这篇关于Emacs的typeover骨架对插入,也许的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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