0

I want to change the navigation keyboard shortcuts when using bash in xterm to use the Ctrl-ijkl, instead of Ctrl-pbnf. For example, I want to be able to navigate forward in the line by pressing Ctrl-l, instead of Ctrl-f. I also wanted to change the start-of-line and end-of-line commands to C-u and C-o. I was able to do this in emacs by adding the following to my .emacs

(global-set-key (kbd "C-j") 'backward-char)
(global-set-key (kbd "C-k") 'next-line)
(global-set-key (kbd "C-l") 'forward-char)
(global-set-key (kbd "C-u") 'start-of-line)
(global-set-key (kbd "C-o") 'end-of-line)

In the case of C-i, I had to remap the C key in emacs to the relatively unused super key to avoid also remapping TAB with C-i

(keyboard-translate ?\C-i ?\H-i)
(global-set-key [?\H-i] 'previous-line)

I found in this answer that you can avoid that particular pitfall in xterm by remapping Ctrl-i to send a different keycode

XTerm*Translations: #override\
    Ctrl ~Meta ~Shift <Key>i    :string("\033[105;5u")

So I wanted to know, is it possible in xterm to remap key combinations to navigation commands as I did in emacs?

Thomas Dickey
  • 76,765

0 Answers0