Tuesday, May 7, 2024
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 1324  / 1 Year ago, mon, december 26, 2022, 4:33:38

What I struggle with:


I'm configuring ~/.inputrc file to be same as mine custom emacs key-bindings and I'm struggling very much with readline's key sequences.


What I mean by that is that if I want to set <up> / <down>, I have to set it to "e[A" / "e[B"


How can I infer keyseq for <F1>..<F12> or even if I want to bind something to let's say (kbd "C-x <M-f7>") in emacs terminology (ie: to [control]+[x] [alt]+[f7] be one keyseq)?




What I want:


Is there any command that tells me for certain key on keyboard what its escape sequence? If there isn't any command, is there any other resource (article/table/...) with some hints?


--> goal: replace <KEY SEQUENCE> with proper keyseq

"<f3>" : start-kbd-macro
"<S-f4>" : end-kbd-macro
"C-x <C-M-S-f4>" : dump-macro
"<f4>" : call-last-kbd-macro
... more keybindings ...



More From » keyboard-layout

 Answers
2

I found solution: use emacs -nw and function insert-quoted (default bind to Ctrl+q).


Ctrl+q will result in ^[[A

Ctrl+q F1 in ^[[[A


Lines in ~/.inputrc will then be following (results may vary depending on environment - mostly $TERM variable):


"e[[A": "pressed up key"
"e[[[A": "pressed F1"



Motivation to change your .inputrc can be following.


Don't you like emacs-like keys for navigating along line and history?

I don't and I prefer ErgoEmacs key bindings because they are logical and I want to use them not only in Emacs but system wide.


"ej": backward-char
"el": forward-char
"ei": previous-history
"ek": next-history
"eh": beginning-of-line
"eH": end-of-line
"eu": backward-word
"eo": forward-word
"eg": kill-line
"eG": backward-kill-line
"ee": backward-kill-word
"er": kill-word
"ed": backward-delete-char
"ef": delete-char
"ez": undo
"ex": kill-region
"ec": copy-region-as-kill
"ev": yank
"e;": forward-search-history
"e:": reverse-search-history

I have written "sudo aptitude install" so many times (usually after fresh install) that I have M-a M-i (ie Alt+a Alt+i) as shortcut for that (because alias to same thing don't autocomplete)


"eaei": "sudo aptitude install "



There are plenty other reasons why you should have your own ~/.inputrc ...


[#40012] Tuesday, December 27, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aradxalte

Total Points: 70
Total Questions: 116
Total Answers: 116

Location: Dominica
Member since Sat, Nov 5, 2022
2 Years ago
;