Vi vs vim, or, is there any reason why I would ever want to use vi?

I know a bit about *NIX text editors (currently migrating from nano to vim), and, after looking around a bit on the Unix & Linux SE, have noticed that vi is used instead of ‘vim’ in a fair number of questions. I know that ‘vim’ stands for ‘Vi IMproved’, and, with that in mind, am wondering why anyone would rather use vi instead of vim. Does vi have any significant advantage over vim?

Edit: I think that my question is being misinterpreted. I know that vim is, for the most part, significantly more powerful and feature-complete then vi is. What I want to know is if there are any possible cases where vi has an advantage over vim, such as less memory use, prevalence on *nix systems, etc.

Asked By: fouric

||

No vi doesn’t have any significant advantage over vim rather its the other way around.
Vim has more advantages then Vi.
You may be interested in : Why, oh WHY, do those #?@! nutheads use vi?

Edit also read : Is learning VIM worth the effort?

Answered By: abhixec

The advantage is that vi usually preinstalled in enterprise UNIX like AIX or Solaris. Besides vim is not accessible on installation media.

Answered By: dchirikov

I would have a hard time living without vim but I can’t stand vi. However, learning the former will at least leave you with an idea of how to deal with the later when that’s all that is available.

The vim interface by default is actually pretty close to vi. If I’m working on a system with vim the first thing I do is add this stuff to ~/.vimrc:

syntax enable
set nocp
set wildmenu

There’s a bunch of other stuff I prefer — nowrap and numbering on, etc — but never mind. “syntax enable” just turns on basic syntax highlighting (somewhat beefier: filetype plugin on is fundamental too); “nocp” turns off vi compatibility and it is this that starts to distinguish vim from ye olde vi (eg, it enables showmode which makes the whole experience somewhat more human, since you now have some clue about whether you are in command or ~INSERT~ mode). “wildmenu” just gives you a horizontal completion menu when doing some things, which makes life easier too.

The text editing facilities of vim are second to none — other than emacs, I’ve never seen or heard of a piece of software that comes close. They are not easy to learn, but once you know them, they are much faster than mouse menus to use and much more dynamic than the simple key macro alternatives in mouse menu based interfaces. For programming, I sometimes use vim alongside an IDE like Eclipse, but I do most of the work in vim.

If you take that path, lol, look into the autocompletion and taglist plugins. And beware the dark side.

Answered By: goldilocks

After spending a large fraction of my life (not including childhood) editing
comfortably with Vim, I spent about a month only using vi. In doing so, I
realized that I had been dependent on Vim for all of my text modification
needs. Before my trip with vi, whenever I had to substitute some text or
perform a similar operation in a large group of files, I would just open up the
files in Vim and run a :bufdo command, and whenever I had to indent or format
some files, I would open them up in Vim and use Vim’s = and gw commands. I
was Vim-dependent. After realizing vi did not have these commands, I was forced
to perform bulk text transformations with sed and learned a great deal about
other programs such as awk and indent. Though I switched back to using Vim
in the end, the knowledge I gained by using a less featured editor was
substantial and has proved to be extremely useful. In addition to learning
about tools outside of a text editor, I also became better acquainted with vi.
Whenever I am working on a new system or a server that doesn’t have Vim, I feel
much more comfortable using vi than I did before my month-long excursion.

Also, last month I installed Linux on a cheap WM8650 tablet and found there to
be a noticeable performance difference between Vim and vi, so I tend to use vi
on the tablet.

Answered By: user26112

I have noticed that I only choose Vi over VIM when I am copying and pasting a text document or config file that I have used cat command. This is because when I try to ctrl-c and then ctrl-v into the VIM opened document, it forces all lines to have a comment infront of them. So when I use Vi to ctrl-v or paste into the Vi opened document, it pastes exactly what I copied from. Other than that, I use VIM all day long.

Enjoy!

Answered By: Tony-Caffe

vi is (also) a POSIX standard editor. There are plenty of implementations and vim is likely the most popular.

While many traditional Unix compliant OSes provide vi implementations very close to the standard, vim has added a lot of extra features that make it a double-edged sword.

Of course, these extensions are usually designed to ease the editing process and provide useful features and functionalities. However, once you are used to some of them (not the cosmetic ones like syntax coloring but those that change the editor’s behavior) you can easily forget they are specific; and using a different implementation, including the ones based on the original BSD code can be very frustrating. The opposite is also true.

This is quite similar to the issue that happens with scripts using non POSIX bashisms faced to more orthodox shell implementations like dash or ksh.

Answered By: jlliagre

As previous answers have already mentioned, vi comes with just about every UNIX system out there.

I just wanted to add an example. Arch Linux is one particularly popular and lightweight distro which neither the Installer, or the base distro comes with vim by default, however both come with vi.

This is not an advantage for vi per se, because you can simply install vim manually, and there’s little you need to accomplish in the installation that requires a text editor, and nothing where vim is superior to vi for the intended purpose. But understanding the difference and that vi is more ubiquitous and lightweight than vim does give it some niche advantages.

Also, just to be comprehensive, no one has yet metioned explicitly that vi is a direct precursor to vim. Vim was desinged specifically to be everything that vi was, and more.

So in a very direct way, vim is superior to vi, because it was designed to be.

Answered By: DryLabRebel

The only reason ever to use vi over vim is when you have no other choice.

There’s many, many reasons why vim stands for “vi improved”!

Borrowing from a related post I answered:-

  1. Multiple windows – horizontal, vertical & tabs.
  2. Visual highlighting.
  3. Online help via the :help command.
  4. Record macros into a register that you can then execute.
  5. Undo (and redo) multiple times, rather than old vi’s insane undo
    toggle.
  6. Command line history, search history.
  7. An entire language embedded along with a host of available
    functions, eg getcwd()
  8. Vastly expanded pattern matching.
  9. Word completion via ctrl-P & ctrl-N.
  10. A built in file navigator (a little clunky, but can be useful).
  11. The ESC key actually quits commands you were trying to, well,
    escape from instead of (insanely) running them as vi does.
  12. Ability to run commands on all buffers, args or windows via bufdo,
    argdo & windo.
Answered By: Paul T

This is exerpt from Vim Koans:

Master Wq and the Unix master

An old Unix master came to Master Wq. “I am troubled, Wq. You teach the way of Vim. vi is holy but Vim is not; its code sprawls, its features crowd memory; its binaries are vast, its behavior inconsistent. This is not the way of Unix. I fear you mislead your students. What can be done?”

Master Wq nodded. “You are right,” he said. “Vim is broken. Let us fix it. Shall we begin?”

The old Unix master agreed, and opened a shell. He typed:

$ vi vim.c

He began to code. Master Wq watched for a while and then asked him, “Which implementation of vi are you using? Nvi? Vim? Elvis?”

“I don’t know,” said the Unix master. “It doesn’t matter.”

Master Wq nodded. The Unix master sat stunned for a moment and closed his document unsaved.

Answered By: modlin

The UNIX philosophy of "do one thing and do it well" is a valuable life lesson, one I have often learned by doing the opposite and suffering for it.

Other commenters note how they learned how to use other tools like sed when they had to do things vi could not do. That’s valuable, to work with a box of independent modular tools.

I can testify to the reverse, having cut off enough fingers playing with the Swiss-army chainsaw that is Vim. I spent too much time getting into exotic fragile plugin package ecosystems, Vimscript etc. when really I should have been writing standalone scripts or doing something else entirely — anything that wouldn’t break my editor if it broke.

Of course this is really a matter of self-discipline. I personally tend to play with and over-optimize things with bells and whistles until it breaks.

Using vi is like drawing with a stick of heavy charcoal — I’ve got to get in there and do things that matter — instead of fiddling around, finely erasing, and hesitantly redrawing lines — as I would with a nice mechanical pencil with lots of features. Sometimes one has got to draw, and not doodle.

These are aesthetics that can affect how I work for better or for worse. I’m not a purist. There’s just something comfortable and familiar with the grip in using standard vi, so instead of changing the user I just change the tool and get on with life.

Answered By: Vijay Pattisapu
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.