Ubuntu - Fix arrow keys in vi

Posted in Linux , simple , tweaks

Do letters show up when you hit the arrow keys in edit mode?

If you like to use the arrow keys in vim/vi, you will quickly notice that Ubuntu appears broken. Welcome to vim compatibility mode.
hulk-mad-at-vi-compatibility-mode
It has always been broken this way in Ubuntu and this probably won’t change in the future.
(Be thankful they even keep the shell around!)

It’s just a setting that Ubuntu defaults to…

In vim, type this:

:set nocompatible

Better yet, stick it in the vimrc script in your home directory so you don’t have to remember to type it each time.

user@brokuntu:/$ echo “set nocompatible” >> ~/.vimrc

B
B
B
D
Goodbye alphabet soup hulk rage…

Posted by admica   @   10 May 2010

Related Posts

Like this post? Share it!

Digg Twitter StumbleUpon Delicious Technorati Facebook RSS

6 Comments

Comments
May 18, 2010
5:59 am
#1 stephen :

umm this gives me an error of

Not an editor command: “set nocompatible”

May 19, 2010
8:49 am
#2 admica :

It works in ubuntu and fedora. It should work in any vim. Are you sure you didn’t have a typo? It works for me. It you start up vi and the first character you press is the colon, followed by “set nocompatible” without the quotes, and hit return, that should be all you have to do. If you typed it wrong you should see “Exxx: Unknown option:” with some random number instead of the x’s.

Sep 18, 2010
2:58 pm
#3 thanatos2k :

Starting up vi and typing it in manually will work, but the echo command won’t. The quotes must be removed to solve Stephen’s problem.

Should read:
echo set nocompatible >> ~/.vimrc

Stephen: if you already did the command with the quotes, just edit the .vimrc file (vi ~/.vimrc) and remove the quotes on the line that says “set nocompatible” (will be the only line in there if you don’t have any other vimrc commands saved)

Sep 20, 2010
9:40 am
#4 admica :

Echo will eat the quotes. They will not show up in your .vimrc file. If you want echo to ouput quotation marks, you must escape them.

$ echo “hello”
hello
$ echo \”hello\”
“hello”

You might have mixed up the vi command with the echo command from a shell? Or maybe you’re using a shell other than bash?

Dec 18, 2010
4:32 am
#5 Nick :

Thanks! This is one of the things that annoy me every single time I set up a new machine. It’s not frequent enough to let this hint stick to my brain though - maybe next time :)

Oct 16, 2011
8:48 pm
#6 Rich :

thank god…isht was driving me crazy…thank you

Leave a Comment

Name

Email

Website

Previous Post
« High-frequency Stock Trading coupled with Flash Trading
Next Post
Support indie developers Wolfire Games - Get the Humble Bundle »
Powered by Wordpress   |   Lunated designed by ZenVerse