Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This problem only happens in Gvim. It does not happen in the console version of vim. I'm running Gvim 7.2.245 on a Ubuntu 9.10 machine.

After opening Gvim, I can type :sh and get to the shell prompt. I can then execute a command (eg ls). However, if I want to execute that command again by pressing the "up" arrow key, I can a garbled mess of what looks like some binary and then the letters "ku". Similarly pressing the "down" arrow gives the same result followed by the letters "kd".

If I press ESC then one of the arrow keys, I ONLY get the letters (eg "ku") without the garbled binary.

Perhaps this issue has something to do with text-terminals and vim cursor-keys or something. Does anyone have the answer to it?

share|improve this question
up vote 2 down vote accepted

It probably has to do with the fact that vim's terminal emulation doesn't have readline support. What is readline, you ask?

Well here is a little intro from the main website:

The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in. Both Emacs and vi editing modes are available. The Readline library includes additional functions to maintain a list of previously-entered command lines, to recall and perhaps reedit those lines, and perform csh-like history expansion on previous commands.

Readline is what lets you use the arrow keys to alter text before you execute it on the terminal, for example. So the behavior you're describing is perfectly normal.

share|improve this answer
Thanks for the quick response. Do know how to configure / build vim to have readline support? – Chad Braun-Duin Dec 9 '09 at 12:45
This is really only tangentially related to “readline”. Whether Gvim provides a terminal emulation to sub-processes is the real issue. The documentation (:help gui-tty) seems to imply that Vim’s GUI mode does not supply an actual terminal emulation. This is not an issue when running a tty-based Vim (in xterm, gnome-terminal, konsole, etc.) since the subprocesses have access to the same terminal emulator that Vim itself uses when it is active. – Chris Johnsen Sep 14 '10 at 4:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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