Archive for the ‘Uncategorized’ Category

(Fix) Ubuntu vi Arrows Keys that display A B C D (on remote shell)

April 1, 2013

Ubuntu uses vim.tiny by default, which is a very minimal vim. You can find out which one is being used by tracking down the links to the final point, and then you can use some commands such as “dpkg -S finalpoint” or “apt-cache showpkg finalpoint” to figure out where it came from and what it is.

$ which vi; which vim



Let’s see what are those:

$ ls -la /usr/bin/vi*

lrwxrwxrwx 1 root root 20 Jan 8 00:57 /usr/bin/vi -> /etc/alternatives/vi

lrwxrwxrwx 1 root root 21 Apr 1 19:34 /usr/bin/vim -> /etc/alternatives/vim

Many utilities and programs like gcc, mail, vi, java, awk, etc. are linked and grouped in /etc/alternitives/ under Ubuntu to allow a common set of tool names to be used with different packages that provide the same functionality.

Let’s dig furthe:

$ ls -la /etc/alternatives/vi*

lrwxrwxrwx 1 root root 17 Jan 8 00:57 /etc/alternatives/vi -> /usr/bin/vim.tiny

lrwxrwxrwx 1 root root 18 Apr 1 19:34 /etc/alternatives/vim -> /usr/bin/vim.basic

By default, you probably don’t get the vim lines in previous commands. Because, you have vim-tiny only.

If your arrow keys don’t function as you expect in insert (and “replace”!) mode. Then some quick solutions are available such as:

$ echo “set nocompatible” >> ~/.vimrc

A straight, not a curly quotes!


You can install a different “clone” of vim using apt-get or another package management tool. For example, issue apt-get install vim-gnome for GNOME2 GUI , vim-gtk for GTK2 GUI , or vim alone to get vim.basic like mine!