vim (not vi) runs in compatible mode by default
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
vim (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: vim
Please read this report from the user's point of view, because as a developer you probably already have tuned `vim` to run in nocompatible mode.
When you install `vim` in Ubuntu, it may run in "compatible mode". "compatible mode" causes arrow keys to output A, B, C, D in insert mode, remove --INSERT-- marker from the bottom line, 'u' to undo only the last change, 'cw' not erasing the word before editing, etc. When `vim` is switched into compatible mode - it causes a lot of frustration.
"compatible mode" is needed, because `vim` replaced `vi` editor many years ago and people used to the behavior of old editor. These people still used `vi` command to invoke the editor, but this time it was new `vim` working behind the scenes. People could set "nocompatible" option in config file to use the latest and greatest features of 'vim' while still invoking it with `vi` command.
It is logical to assume that to avoid extra configuration people could execute `vim` command to run `vim` in nocompatible mode and `vi` to work in compatible. But many Ubuntu releases have passed, installed and removed, and this is not achieved yet. I hope we all agree that by executing `vim` we want the default features of `vim` and not `vi` in Ubuntu. Let's see that this doesn't work consistently.
First, remove your current `vim`:
$ sudo rm -rf /etc/vim
$ rm ~/.viminfo
$ rm ~/.vimrc
$ sudo aptitude purge vim vim-common vim-gnome vim-gui-common vim-runtime vim-tiny
Now install `vim-tiny` as it is the version of `vim` that comes preinstalled in Ubuntu through ubuntu-minimal core package (see http://
$ sudo aptitude install vim-tiny
$ vim
bash: /usr/bin/vim: No such file or directory
There is no `vim`, but if you launch `vi` you will actually see `vim` title screen. Of course, being executed as `vi` it runs in compatible mode by default. Now installing `vim`:
$ sudo aptitude install vim
$ vim
It runs in `nocompatible` mode and seems like everything works as expected. What about `vi`:
$ vi
:set compatible?
nocompatible
This is bug#1 - installed `vim` package changes default behavior of `vi` command, i.e. implicitly changes behavior of other package. When users used to the fact that `vi` command has arrow keys and syntax highlighting support, they forget that it is was actually provided by `vim` and start to experience problems on new systems. About 80% of `vim` questions here are about "vim features that don't work in vi" - https:/
Let's try to return `vi` the original behavior, so that `vi` runs in compatible mode and `vim` is not. It is safe to assume that mode problems are caused by configuration files. Let's get rid of them:
$ sudo rm -rf /etc/vim
$ vi
:set compatible?
compatible
Good. What about `vim`?
$ vim
:set compatible?
compatible
This is bug #2: vim (not vi) runs in compatible mode by default.
Let's try to fix this by reinstalling vim:
$ sudo aptitude remove vim
$ sudo aptitude install vim
$ vim
:set compatible?
compatible
As you can see it is not fixed. All these bugs could be avoided if `vi` command provided in Ubuntu as a script that launches `vim` in forced "compatible mode" while the `vim` command itself without any configuration always work in "nocompatible".
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
I've edited bugreport, because in the process of reporting it new facts where discovered that slightly changed the meaning. Please reread it, if you opened the report before the timestamp in this comment.