1

我正在尝试将backwards-kill-line 绑定到Ctrl-Backspace。以下绑定工作:

(global-set-key (kbd "C-\d") 'backward-kill-line) ; emacs-w32
(global-set-key (kbd "\b") 'backward-kill-line) ; xterm

但是,当我从 Windows 登录 ssh 时,我通常使用 Mintty。Bash 报告的 Ctrl-v 序列是 '\037' 但 emacs 无法识别。相反,每次我在使用 Mintty 术语运行 emacs 时按 Ctrl-Backspace 时,都会将以下字符发送到缓冲区:';5u'。

有没有办法告诉 emacs 使用 ';5u' 作为键绑定?指定 (kbd ";5u") 将不起作用,因为 emacs 需要单个字符。

4

1 回答 1

-1

Make Emacs do help for you, type C-h k and your C-v, Emacs shown something like I get for Ctrl + numPlus when do this in xterm:

M-O 5 k is undefined

which I translate into

 (global-set-key (kbd "M-O 5 k") 'end-of-line)

and that work fine!

UPDATE Use my expect script to get byte sequence from terminal you get when press key combination: http://sourceforge.net/u/gavenkoa/utils/ci/default/tree/misc/keyseq.exp

If you use mintty I check docs: https://code.google.com/p/mintty/wiki/Tips and your key code sequence is very similar to another examples so I believe that:

 (global-set-key (kbd "\e[1;5u") 'end-of-line)

do job for you.

Check topics from (info "(elisp)Reading Input).

UPDATE 2 You are trapped into Ctrl+Backspace issue for terminals, investigate info yourself: https://www.google.com.ua/search?q=ctrl+backspace+terminal

I remember that I have same issue few years ago. Main problem that Ctrl+Backspace generate same byte sequence in terminal emulators as Ctrl-H. For that reason I train to use ESC Backspace for deleting word backward. I never deep into terminal emulation standarts and implementation code to understand if it possible to generate different code sequence in mintty for C-Backspace ((

于 2015-04-16T20:27:24.450 回答