从邪恶命令模式(M-x未定义)使用'execute-extended-command' [英] Use 'execute-extended-command' from Evil command mode (M-x is undefined)

查看:188
本文介绍了从邪恶命令模式(M-x未定义)使用'execute-extended-command'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始尝试使用emacs。作为一个Vim用户,我不想在没有安装恶意模式的情况下使用它。



然而,邪恶模式似乎打破了emacs的键盘绑定,扩展命令'(Mx)。



我真的不在乎这个键盘绑定,我注意到我可以从恶意中调用'list-packages'命令模式,它的工作正常。
只有我现在缺少的东西是TAB在命令模式下自动完成,就像键入'list-'TAB,然后它将显示或迭代可用的命令。
这是否可能与邪恶模式?



或者最终有一个简单的方法来解决这个键盘绑定? / em>



我正在使用:




  • debian jessie

  • GNU Emacs 24.4.1



编辑:



我的.emacs文件:

 (require'package)
(push' (marmaladehttp://marmalade-repo.org/packages/)
包档案)
(推'(melpa。http://melpa.milkbox.net / packages /)
package-archives)

(add-to-list'load-path〜/ .emacs.d / evil)
(require'evil )
(邪恶模式1)

(define-key evil-normal-state-map [escape]'keyboard-quit)
(define-key evil-visual- state-map [escape]'keyboard-quit)
(define-key minibuffer-local-map [escape]'minibuffer-keyboard-quit)
(define-key minibuffer-local-ns-map [ escape]'minibuffer-keyboard-quit)
(define-key minibuffer-local-completio n-map [escape]'minibuffer-keyboard-quit)
(define-key minibuffer-local-must-match-map [escape]'minibuffer-keyboard-quit)
(define-key minibuffer- local-isearch-map [escape]'minibuffer-keyboard-quit)

添加Modifier-x

 (global-set-key(kbdCx)'execute-extended-command )

和Alt-x

 (global-set-key(kbdAx)'execute-extended-command)

但是这些尝试没有修复键盘绑定,所以我决定用超级键滚动

 (global-set-key(kbdsx)'execute-extended-command)


解决方案

修复键盘绑定非常简单 - 只需将此行添加到您的 .emacs 文件(或在临时缓冲区中评估):

 (global-set-key(kbd把你的组合在这里>)'execute-extended-command)

你可以使用来自ErgoEmacs的参考了解如何为 kbd 函数。



和IMO,最好使用标准Emacs来运行命令 - 使用你的邪恶模式命令模式,并使用 Mx / execute-extended-command 与Emacs配合使用。 p>

I just started experimenting with emacs. And as a Vim user I did not want to bother use it without installing evil-mode first.

However, evil-mode seems to break the emacs keybinding for 'execute-extended-command' (M-x).

I really don't care about this keybinding, and I noticed that I can call for example 'list-packages' from the evil command-mode and it works just fine. Only thing I am missing now, is the TAB auto completion in command mode, like typing 'list-' TAB and then it will show or iterate available commands. Is this possible with evil-mode?

or is there eventually an easy way to fix this keybinding?

I am using:

  • debian jessie
  • GNU Emacs 24.4.1

EDIT:

My .emacs file:

(require 'package)
(push '("marmalade" . "http://marmalade-repo.org/packages/")
    package-archives )
(push '("melpa" . "http://melpa.milkbox.net/packages/")
    package-archives)

(add-to-list 'load-path "~/.emacs.d/evil")
(require 'evil)
(evil-mode 1)

(define-key evil-normal-state-map [escape] 'keyboard-quit)
(define-key evil-visual-state-map [escape] 'keyboard-quit)
(define-key minibuffer-local-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-ns-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-completion-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-must-match-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-isearch-map [escape] 'minibuffer-keyboard-quit)

I attempted to add Modifier-x

(global-set-key (kbd "C-x") 'execute-extended-command)

and Alt-x

(global-set-key (kbd "A-x") 'execute-extended-command)

but these attempts didn't fix the keybinding, so I've decided to roll with super key

(global-set-key (kbd "s-x") 'execute-extended-command)

解决方案

Fixing keyboard bindings is quite easy - just add this line to your .emacs file (or evaluate it in the scratch buffer):

(global-set-key (kbd "< put your key combination here >") 'execute-extended-command)

You can use reference from ErgoEmacs to understand how to provide key combinations for kbd function.

And IMO it's better to use standard Emacs means to run commands - use your evil-mode command mode for evil-related things, and use M-x/execute-extended-command to work with Emacs.

这篇关于从邪恶命令模式(M-x未定义)使用'execute-extended-command'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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