Attaching custom escape sequence to kHome key
by usr345 from LinuxQuestions.org on (#6HCKA)
My idea is to attach an action in vim to kHome key (Home located on numeric keypad) that will not affect ordinary Home key. In terminal I run:
Code:$ cat
# pressed kHome
^[[1~
# pressed Home
^[[1~So, Home and kHome give the same escape sequence. I decided to attach my own escape sequence to kHome.
Code:$ showkey
# pressed kHome
keycode 71 press
keycode 71 release
# pressed Home
keycode 102 press
keycode 102 releaseSo, kHomes code is 71. I created a file ~/funcskeys:
Code:keycode 71 = F13
string F13 = "\033[1;5G"I don't fully understand how custom escape sequences should be constructed, so I created it using an old answer and examples from the Internet. Then I ran as root:
Code:# loadkeys -c ./funcskeysWhen I run cat again I still get the old escase sequence:
Code:$ cat
# pressed kHome
^[[1~What's wrong? Maybe, I need to delete the old escape sequence from the key first?
Code:$ cat
# pressed kHome
^[[1~
# pressed Home
^[[1~So, Home and kHome give the same escape sequence. I decided to attach my own escape sequence to kHome.
Code:$ showkey
# pressed kHome
keycode 71 press
keycode 71 release
# pressed Home
keycode 102 press
keycode 102 releaseSo, kHomes code is 71. I created a file ~/funcskeys:
Code:keycode 71 = F13
string F13 = "\033[1;5G"I don't fully understand how custom escape sequences should be constructed, so I created it using an old answer and examples from the Internet. Then I ran as root:
Code:# loadkeys -c ./funcskeysWhen I run cat again I still get the old escase sequence:
Code:$ cat
# pressed kHome
^[[1~What's wrong? Maybe, I need to delete the old escape sequence from the key first?