Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does vi behave differently in Ubuntu than in CentOS?

Tags:

vim

ubuntu

centos

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?

like image 555
Adam Plumb Avatar asked Jul 02 '09 14:07

Adam Plumb


People also ask

Is vi installed by default on Ubuntu?

vi is installed by default on almost all Linux (and other Unix) systems for many decades. This makes it something like the lowest common denominator, the editor every Linux/Unix user should at least know a little bit about in order to fix small problems (and install other editors if they want).

Should I use vi or vim?

Vim is a vi-like editor but is more advanced and powerful than the original Vi. It has many features that Vi does not, even features that are not “advanced.” Let's now see what the main differences between them are.


1 Answers

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)

like image 144
Jeremy Smyth Avatar answered Oct 10 '22 17:10

Jeremy Smyth