vimubuntucentos

Why does vi behave differently in Ubuntu than in 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?


Solution

  • 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)