Why vim keep printing strange characters when I hit non-characters key?

  • Insert prints [2~
  • Delete prints [3~
  • Page Up prints [5~
  • Page Down prints [6~
  • Home prints OH
  • End prints OF
  • Arrow Up prints OA
  • Arrow Down prints OB
  • Arrow Right prints OC
  • Arrow Left prints OD

How can I fix this?

  • what terminal are you using?
    – elyashiv
    Mar 31, 2015 at 20:23
  • Terminator and run on Arch linux
    – Mas Bagol
    Mar 31, 2015 at 20:37
  • These chars are the representation of the key you pressed.
    – elyashiv
    Mar 31, 2015 at 20:49
  • These are the escape sequences sent by the keys minus the initial escape character. Are they printed in the status line? Normally they should be recorded in the terminal database and vim should find them on its own. What is the value of the TERM environment variable? Do other terminal applications (less, bash, …) recognize the keys properly? Do the keys work in other terminal emulators? Do you have the same problem if you run vim -u /dev/null? Mar 31, 2015 at 21:47
  • It's only happens on vim. Works in terminal emulator. I've tried to use xterm and linux on TERM environment variable. Both have no effects. I`ve tried every possible value for set term inside vim too. It still has no any effects
    – Mas Bagol
    Mar 31, 2015 at 21:57

1 Answer 1


According to Terminator's FAQ:

  1. You should set TERM = terminator because it uses a non-conventional terminfo file.
  2. You should guarantee that you don't have vim-minimal (or similar) package, because it might not include support for terminfo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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