I've been trying to map Ctrl + F8 in several different ways but I just can't get it to work. After I made some researches I found out that vim doesn't support all terminal keycodes and I have to assign the terminal keycode to an empty vim keycode (like F13). I followed this guide step by step without no success.

What i did is:

  1. Find the terminal (URxvt) keycode for Ctrl + F8 using cat. The result is: ^[[19^
  2. Added the following lines to my plugin file:

set <F13>=^[[1;2B nnoremap <F13> :call foobar

Any suggestions?


[After testing, I have transferred my comment to an answer.]

Your set command is not using the same value as your scancode. Also, you need to be sure you're using an escape character instead of the two characters of ^ and [. To make this easy without "hard coding" an escape character, I would use :execute:

:exe "set <F13>=\e[19^"
:nnoremap <F13> :echo "It works!"<CR>
  • Thank you very much :). Works perfectly fine. However I don't really understand what "\e" means and why ":execute" works and ":set" alone doesn't – Mr. Blue Sep 23 '16 at 22:27
  • Because, for historical reasons, :set cannot have evaluation or string expansion used at all, we get around that with :execute. \e in double quotes is a string escape sequence that becomes a true escape character. – Heptite Sep 23 '16 at 22:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.