Emacs Ctrl修饰符在控制台中不起作用 [英] Emacs Ctrl modifiers don't work in console
问题描述
我有两个热键为dired,在GUI模式下工作在Emacs:
(add-hook' -hook
(lambda()
(define-key dired-mode-map(kbdC-< up& file..))))))
(add-hook'dired-mode-hook
(lambda()
(define-key dired-mode-map kbdC-< right)'diredp-find-file-reuse-dir-buffer)))
$ b b
但是当我在控制台中单击Ctrl-right或Ctrl-up时,光标就像按下箭头一样移动。
当我尝试Ctrl-h k
如何在控制台中修复这个奇怪的行为?
我使用Linux Slackware 14,Emacs 24.2.1。
1.创建一个带有内容的文件funcskeys:
控制键码105 = F100
string F100 =\033 [1; 5D
控制键码106 = F101
字符串F101 = \ 033 [1; 5C
control keycode 103 = F102
string F102 =\033 [1; 5E
altgr keycode 105 = F103
string F103 = \033 [1; 5F
结尾必须是空行! >
2.在根下加载文件:
#loadkeys funcskeys
3.将其插入.emacs的开头:
(define-key input-decode-map\e [1; 5C[(control right)])
定义键输入解码映射\e [1; 5D[(控制左)])
(定义键输入解码映射\e [1; 5E )])
(define-key input-decode-map\e [1; 5F[(meta left)])))
algorythm结束
此热键可以使用:
(global-set-key(kbdC-< right>)'forward-word)
-set-key(kbdC-< left>)'backward-word)
I have 2 hotkeys for dired, that work in GUI mode in Emacs:
(add-hook 'dired-mode-hook
(lambda ()
(define-key dired-mode-map (kbd "C-<up>")
(lambda () (interactive) (find-alternate-file "..")))))
(add-hook 'dired-mode-hook
(lambda ()
(define-key dired-mode-map (kbd "C-<right>") 'diredp-find-file-reuse-dir-buffer)))
But when I click Ctrl-right or Ctrl-up in console the cursor just moves as if the arrow was pressed.
When I try Ctrl-h k and then Ctrl-right, it gives me the right key docs as if Ctrl wasn't pressed at all.
How to fix this strange behaviour in console?
I am using Linux Slackware 14, Emacs 24.2.1.
Here is the algorithm, how to make modifier keys work in Emacs in terminal.
1.Create a file funcskeys with content:
control keycode 105 = F100
string F100 = "\033[1;5D"
control keycode 106 = F101
string F101 = "\033[1;5C"
control keycode 103 = F102
string F102 = "\033[1;5E"
altgr keycode 105 = F103
string F103 = "\033[1;5F"
At the end must be an empty line!
2.Under root load the file:
#loadkeys funcskeys
3.Put this into the beginning of .emacs:
(unless (display-graphic-p)
(progn
(define-key input-decode-map "\e[1;5C" [(control right)])
(define-key input-decode-map "\e[1;5D" [(control left)])
(define-key input-decode-map "\e[1;5E" [(control up)])
(define-key input-decode-map "\e[1;5F" [(meta left)])))
End of algorythm
After this hotkeys will work:
(global-set-key (kbd "C-<right>") 'forward-word)
(global-set-key (kbd "C-<left>") 'backward-word)
这篇关于Emacs Ctrl修饰符在控制台中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!