tags:

views:

1067

answers:

6

I've been getting more and more comfortable using vi on a daily basis, but one thing that bothers me is that when I use it on Ubuntu it behaves differently than when I use it on CentOS (and probably other places). I actually prefer the way it works in CentOS.

Here are three things that are really bothering me on Ubuntu:

  1. In CentOS insert mode there is a big bold notice at the bottom that I'm in INSERT mode, but in Ubuntu there is no notice so I can never tell which mode I'm in.

  2. In CentOS insert mode I can press the up/down keys and the cursor will move up and down. But when I'm in Ubuntu pressing up and down inserts the letters A and B respectively on new lines.

  3. In CentOS insert mode I can use the backspace key and it will delete the character that is before the cursor, but in Ubuntu I just hear a beep sound and nothing happens. I can press the delete key in command mode, but I'd rather be able to press the backspace key.

Are these differences something that I have to live with or is it an easy fix?

A: 

(1) Check if showmode setting is different on both.

(2) Don't know about this one, I think this has more to do with the terminal than Vi itself.

(3) Maybe try using :map <BS> :normal d ?

Swaroop C H
+9  A: 

In ubuntu, the default vim install comes from the package vim-tiny, which isn't the whole thing.

You probably want to:

apt-get install vim

or

apt-get install vim-full

Some of your other problems sound like issues with the backspace key and other things. Once you get the full version of vim, try adding these to your .vimrc:

set nocompatible

set t_kb=^H
fixdel

(IMPORTANT NOTE: that ^H is a literal ctrl-H character, which you'll get by doing Ctrl-V Ctrl-H in insert mode)

Jeremy Smyth
Thanks! I installed vim-full and that fixed all three issues!
Adam Plumb
A: 

I'll assume you mean VIM when you say VI? And at least, the 2nd point seems to be a console/terminal issue with VIM/term combo. The page below suggests some fixes, but none that I could make work (I use vim over putty to an Ubuntu dev box)

http://vim.wikia.com/wiki/Fix_broken_arrow_key_navigation_in_insert_mode

3rd point can be overwritten by using the following in your .vimrc

set backspace=indent,eol,start

Svend
A: 

In CentOS, vi is an alias for a different program, vim, but in recent versions of Ubuntu, vi means just vi, not vim. The difference you see if the difference between two different programs, vi and vim.

If you like vim, just run vim, not vi. This works in Ubuntu too

dmityugov
+1  A: 

In addition to installing vim-full, if you do not already hava a ~/.vimrc:

$ cp /usr/share/vim/vimcurrent/vimrc_example.vim ~/.vimrc

This example .vimrc already makes the most important settings and is a good start for customization.

0x89
A: 

oh god

i always have to look for that when i get on a new machine why can't this be set in a way that the freaking cursor keys are working who would want it the other way around these days???????

can't these few lines not made the default?


set nocompatible
set t_kb=^H
fixdel
martin