How to remap shift-arrow in term-mode?
Is there a way to map Shift-left or other arrow keys to custom functions in term-char-mode?
I tried, but without luck:
(define-key term-mode-map [s-left] 'sandric/term-switch-line-mode)
Entering Shift-left in my terminal gives [1;2D, so I also tried:
(define-key term-mode-map "[1;2D" 'sandric/term-switch-line-mode)
But that also does nothing.
ANS:
Is there a way to map
Shift-leftor other arrow keys to custom functions interm-char-mode?
There is indeed.
(define-key term-mode-map [s-left] 'sandric/term-switch-line-mode)
Two issues here:
-
term-mode-mapis the keymap used by line mode, whereas char mode usesterm-raw-map. -
[s-left](lowercases) corresponds to the<Super>modifier. The<Shift>key is abbreviated as an uppercaseS, as in(kbd "S-<left>")or[S-left].
So the solution to your problem is likely
(define-key term-raw-map [S-left] #'sandric/term-switch-line-mode)
reflink: https://emacs.stackexchange.com/questions/37093/how-to-remap-shift-arrow-in-term-mode
https://www.stacknoob.com/s/osEnkacehHy7WHVquzRgdL

浙公网安备 33010602011771号