22

Apparently Ubuntu 11.10 uses Vim when I type

vi filename

How do I force Ubuntu to use Vi instead?

Knowledge Cube
  • 14,681
  • 15
  • 80
  • 151
Pomario
  • 2,018
  • 7
  • 22
  • 31

6 Answers6

25

You need to install the actual vi package, which is nvi on Ubuntu.

sudo apt-get install nvi

You might also need to run the line below if nvi isn't picked up automatically as the default provider for vi.

sudo update-alternatives --config vi

Leon Nardella
  • 1,855
  • 1
  • 17
  • 23
6

man update-alternatives

vi even get special mention as an example.

Mike
  • 95
  • 1
  • 1
    A very useful man page. They say it's better to teach someone how to fish than to just give him a fish... probably the down-voter didn't agree with that. I upvoted you to cancel it :) – Chan-Ho Suh Mar 08 '12 at 02:48
  • 3
    This answer doesn't really answer the question, does it? – jokerdino Mar 09 '12 at 06:21
3

Check out:

Decide which vi-compatible tool you want to use.

vim, elvis, nvi, vigor (etc). You may want to study the output of apt-cache search editor |grep vi and look for other alternatives. nvi claims to be "bug for bug" compatible with vi.

Once you've done that, install the package:

apt-get install $YOURCHOICE

then run

update-alternatives --config vi

and choose $YOURCHOICE as the one to set as "vi".

Jorge Castro
  • 70,934
  • 124
  • 466
  • 653
med
  • 43
  • 5
1

If by any chance you just want to get rid of Vim specific features, you can also make sure that Vim runs in compatible mode.

UncleZeiv
  • 501
  • 3
  • 7
0

By default, when you type vi in Ubuntu, it actually runs Vim, because over time the Linux OSs have updated and some are now using Vim. If you still want to use vi, you have to install the package that directly runs vi instead of vim.

To install just vi:

sudo apt install nvi

You can also use vim-tiny (preinstalled.)

Another solution is to type busybox vi in the terminal. This brings the default Vi installed on 18.04/18.10. This version is a very small clone of vi.

If you want to make it your default for when you type editor, type sudo update-alternatives --config editor. To make it the default for when you type edit, add export EDITOR="/usr/bin/nvi" to your .bashrc file.

AlexFullinator
  • 1,389
  • 10
  • 31
-1

vim is set as your default editor. Put this as your default editor by setting this environment variable--> export EDITOR=vi

surgemcgee
  • 486
  • 3
  • 15