What are some of the main differences between vim and vi

vivim

What are a few of the main differences between vi and vim? Are there any significant keyboard shortcut differences, any features that one has that the other does not? Yes, I do know that I asked another question similar to this (Vi vs vim, or, is there any reason why I would ever want to use vi?), but the purpose of that question was not a complete comparison between the two, but merely asking if there were any possible situations where vi had the advantage. This post is a direct comparison between the feature-sets of vi and vim.

Edit: I was wrong, this is not a comparison between the features of vi and vim. vim, being Vi IMproved, has many, many more features then vi. What I am asking is, if you have been using vi all your life and one day you sit down and start using vim, what will be different? Or if you were a vim user previously and tried out vi, what differences would you notice?

Best Answer

That's a bit like asking what the difference is between a beaten up Datsun 120Y & a Porsche!

Vim has a multitude of features not offered by plain old vi:-

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

I could rave on for much longer than this, vim has so many more features than plain old vi that there's really no comparison.

PS - To actually use plain old vi, you'd have to be working on a legacy Unix system, e.g. Solaris (sorry guys, it's going that way). You may well be using vim when you think you're using vi, as most Linux distros simply map vi to vim. If :help works, or multiple undos work, or :version works, you're using vim, not vi!

Related Question