问题描述
我是Emacs的新手。我有Emacs 24.3.1安装了恶意模式。我试图绑定 gw
作为各种 evil-window
函数的前缀。例如,我希望 gwl
将窗口重点放在右侧,而$ code> gwh 左侧的窗口。当然,这是在vim中完成的: nnoremap gw< c-w>
。 code> .emacs.d / config / init-bindings.el ,我补充说:
(define-key evil-normal-state-map(kbdgwh)'evil-window-left)
/ pre>
(define-key evil-normal-state-map(kbdgwj窗口向下)
(define-key evil-normal-state-map(kbdgwk)'evil-window-up)
(define-key evil-normal-state-map(kbd gwl)邪恶的窗口)
(define-key evil-normal-state-map(kbdgwv)'evil-window-vnew)
emacs报告此错误:
错误:键序列gwh以非前缀键开始gw
- 如何使
gw
一个前缀键? - 是否有任何理由可能是一个坏主意(与重要的emacs默认设置冲突)?
阅读您的问题(而不是您的答案),我设法将 gwh
映射到邪恶的窗口左边,执行以下操作:
- 是
gw
绑定到一个动作?请求帮助Chk gw
告诉我是的。 -
gz
不是,所以使用gzh
开箱即用:(define-key evil-normal-state-map(kbdgzh)'evil-window-left)
-
所以取消映射
gw
允许使用gwh
:(define-key evil-normal-state-mapgwnil)
(define-key evil-normal-state-map gwh)'邪恶的窗口左)
ps:你仍然可以用Mq填充段落
pps:我自己喜欢windmove与超级密钥more:)
(需要'windmove)
(windmove-default-keybindings'超级)
I'm new to Emacs. I have Emacs 24.3.1 with evil mode installed. I'm trying to bind gw
as a prefix to the various evil-window
functions. For example, I would like gwl
to focus the window to the right, and gwh
the window to the left. Of course, this is done in vim like so: nnoremap gw <c-w>
.
In .emacs.d/config/init-bindings.el
, I added:
(define-key evil-normal-state-map (kbd "g w h") 'evil-window-left)
(define-key evil-normal-state-map (kbd "g w j") 'evil-window-down)
(define-key evil-normal-state-map (kbd "g w k") 'evil-window-up)
(define-key evil-normal-state-map (kbd "g w l") 'evil-window-right)
(define-key evil-normal-state-map (kbd "g w v") 'evil-window-vnew)
And emacs reports this error:
error: Key sequence g w h starts with non-prefix key g w
- How do I make
gw
a prefix key? - Is there any reason this might be a bad idea (conflicts with important emacs defaults)?
Reading your question (and not your answer), I managed to map gwh
to evil-window-left doing the following:
- is
gw
bound to an action ? Asking the help withC-h-k gw
told me yes. gz
isn't, so usinggzh
worked out of the box:(define-key evil-normal-state-map (kbd "gzh") 'evil-window-left)
so un-mapping
gw
allowed to usegwh
:(define-key evil-normal-state-map "gw" nil) (define-key evil-normal-state-map (kbd "gwh") 'evil-window-left)
ps: you still can fill paragraphs with M-q
pps: I myself like windmove with Super key more :)
(require 'windmove)
(windmove-default-keybindings 'super)
这篇关于将emacs的恶意窗口命令绑定到g前缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!