Emacs的自动完成:不要在直列建议RET触发 [英] Emacs auto-complete: don't trigger on RET in inline suggestion

查看:99
本文介绍了Emacs的自动完成:不要在直列建议RET触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很高兴与自动完成,但有一件事我的错误:

I am very happy with auto-complete but one thing bugs me:

我的设置,以立即显示内嵌建议,但有0.9秒的延迟菜单。我如输入前几个字母德尔,这立即得到自动完成内联以删除。如果我想输入删除我打了设置页,这是正常的。但是,如果我想实际键入DEL和一个换行符是什么 - 在这里打 RET 再次自动完成对删除

I'm setup to show the inline suggestion immediately but the menu with 0.9 s delay. I type the first few letters e.g. "del" which get immediately auto-completed inline to "delete". If I wanted to type "delete" I hit TAB and this is alright. But what if I wanted to actually type "del" and a newline - here hitting RET again auto-completes to "delete".

我怎么能强迫 RET 是换行,如果只显示在线的建议吗?一旦显示自动完成菜单我想这再次触发键像往常一样。

How can I force RET to be newline if only inline suggestion is shown? Once the auto-complete menu is displayed I want it to be the trigger key again as usual.

感谢您!

推荐答案

之后,加入其他设置以下行的自动完成模式,您可以通过启用完成<大骨节病> RET 仅在显示菜单完成:

By adding the following lines after other settings for the auto-complete mode, you can enable completion by RET only when completion menu is displayed:

(define-key ac-completing-map "\C-m" nil)
(setq ac-use-menu-map t)
(define-key ac-menu-map "\C-m" 'ac-complete)

AC-完成地图是一个键盘映射,其中<大骨节病> RET 默认绑定到 AC-完整 AC-菜单地图是完成菜单上完成一个键盘映射。当 AC-使用菜单 - 地图变量<$ C $的 AC-菜单地图键盘映射启用C> T 。

ac-completing-map is a keymap where RET is by default bound to ac-complete, and ac-menu-map is a keymap for completion on completion menu. The ac-menu-map keymap is enabled when the ac-use-menu-map variable is t.

仅供参考,完成可以用pressing <大骨节病> C-摹随时停止。所以,你也能打到<大骨节病> C-摹和<大骨节病> RET 与<大骨节病> RET 完整的绑定一个回车换行符。此外,您还可以使用<大骨节病>ç-J 而非<大骨节病> RET 当你想输入一个换行符。 <大骨节病>ç-J 默认不绑定到 AC-完整

FYI, completion can be stopped by pressing C-g at any time. So you will also be able to hit C-g and RET to enter a newline with the bindings of RET intact. Also, you can use C-j rather than RET when you want to enter a newline. C-j does not bind to ac-complete by default.

这篇关于Emacs的自动完成:不要在直列建议RET触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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