문제

When I'm in Emacs with iTerm2, pressing Esc and b after in a short time sends Meta+b which runs backward-word. How can I make them separate keys?

I want to make the change in iterm2 - independent of Emacs.

도움이 되었습니까?

해결책

You can do something like the following:

(global-set-key (kbd "<escape> b") 'your-function)

Hewever, please note that by doing this, you lose the ability to replace the M- modifier by the ESC prefix for all other key bindings, not just M-b.

To limit this potentially unwanted side-effect, you could use the technique presented in this answer, to be able to easily switch between your custom behaviour and the standard one.

Nb: When using Emacs in no-window mode, please note that this will only work if your terminal sends different inputs for ESCb and M-b. Otherwise, there is no way Emacs can tell the difference.

You can check this typing C-hkESCb. If Emacs is receiving a specific input, you will see something like:

M-b (translated from <escape> b) runs ...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top