3

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?

  • on a Linux system, I'm not sure you'll be getting vi. As I see, it is linked to vim. – mdpc Feb 4 '13 at 22:57
1

It's a bit like asking about bash and sh. ViM has a special option compatible (command line -C) - see the ViM manual, then switch it on and try to do some work. And that's not even halfway to vi from 20-30 years ago (when keyboards/terminals often lacked arrow and other - today common - special keys by the way).

Hence if you are used to ViM and end up in front of vi you can still do your stuff but much slower, because most of the thing just doesn't work (either at all or the way you expect).

  • Could you elaborate on some of the things that "just don't work"? – fouric Feb 23 '13 at 18:42
  • In my case for example Insert doesn't work at all, arrow keys in insert mode produce characers, since the terminal sequences are not interpreted, undo behaves differently and much more. Just read help 'compatible' in ViM to get some idea on what can change. – peterph Feb 23 '13 at 21:22
1

Immediately for me, syntax highlighting. Then auto indent and auto comment lines, due to my continual use of paste from my desktop.

Also, vim has the additional functionality of telling you the differences

:help vi_diff

:help vim-additions

1

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!

0

If by vi you mean the original vi, that one was rather broken, had tons of "undocumented commands" (I still fondly remember a long document giving the undocumented and halfway (or more) broken, idiosincratic, totally irregular, and sometimes lifesaving, commands). The extension language(s) for vim are much moore powerfull. Just look at the name's meaning: *V*i *Im*proved, vim undestands itself as bearing vi's flag to the future. Unless you go into nooks and cranies, both schould work the same, with vim having the advantage of continuing development.

0

For me, Vim shows far less idiosyncrasies than vi; e.g. for a change command, the text is removed and you insert text instead of a $ sign placed at the end and you override text until that sign. Or multi-level undo. Or window splits and buffer management.

Then there's the configurability: With vi, you may have a few mappings, change some options. Vim has a plethora of plugins on vim.org, comes with lots of syntax and filetype settings, and has a great community.

Finally, under the hood, is has Vimscript with (since version 7) powerful data types, and the possibility to use a variety of alternative scripting languages like Python, Perl, or Ruby.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.