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

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

/usr/bin/vi

/usr/bin/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!

Or:

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!

Advertisements

Tags: , , , ,

One Response to “(Fix) Ubuntu vi Arrows Keys that display A B C D (on remote shell)”

  1. La vi llorando | Tony Cantero Suarez Says:

    […] (Fix) Ubuntu vi Arrows Keys that display A B C D (on remote shell) (fairsultan.wordpress.com) […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: