33

Today, I decided to try vi instead of Vim; I wanted to see how different it is.

I didn't notice much differences at all. The biggest thing I noticed was how vi didn't say -- INSERT -- when I went into insertion mode, and there were some minor interface differences.

This made me wonder, what are the biggest differences between vi and Vim?

3
  • 2
    You obviously aren't using many advanced features of vim. block select, search for word under cursor, increment number under cursor, syntax highlighting etc.
    – Jim
    Nov 19, 2015 at 3:55
  • 2
    Related post - What is the difference between Vi and Vim?
    – RBT
    Mar 20, 2019 at 8:49
  • There are some obvious nice to haves such as extended key support. Arrow keys work as opposed to hjkl.
    – mreff555
    Jan 7, 2020 at 13:17

5 Answers 5

32

There actually is a help command in Vim to tell you about the differences: :help vi_diff (note the underscore: :help vi_diff)

From Vim's site, the biggest are:

unlimited undo

You can do xxxx and undo each of the four deletes. When was the last time you typed "jjjj" and then found out the caps lock key was on? You accidentally joined five lines together, and Vi can undo only the last command. In Vim you can undo all four "J" commands and get your original text back.

portability

Vi is only available on Unix. Vim works on MS-Windows, Macintosh, Amiga, OS/2, VMS, QNX and other systems. And also on every Unix system.

syntax highlighting

Vim can be programmed to highlight portions of the buffer in different colors or styles, based on the type of file being edited. There are hundreds of syntax highlighting rulesets bundled with Vim.

GUI

Vim works well at a console, but it can run natively in many GUIs, including X Windows, Mac OS, and Microsoft Windows. It uses native GUI widgets for scrolling, dividing buffers, and menuing. It can also talk to the clipboard.

2
  • 4
    Some more differences are mentioned in the faq Nov 18, 2015 at 13:12
  • According to the readme, some of those OSes are no longer supported.
    – Rolf
    Jul 5, 2016 at 8:48
15

Vim has many features that Vi does not, even features that are not obviously "advanced" features.

In practice, this means that if you are used to Vi, you will likely encounter very few differences if you start using Vim (or some other Vi clone), but if you are used to Vim and if your "reflexes" include features such as visual mode highlighting, any key action that starts with "g" or "z", any text action with "i" or "a" [e.g. "daw" to delete a word under the cursor], navigating with arrow keys in insert mode, etc, you will find that those don't work in Vi.

There's also the question of what exactly you were using when you say you "tried Vi". On many systems, "vi" actually runs Vim, in a mode where some of these differences apply (default showmode as you observed, arrow keys don't work in insert mode) and others do not (visual mode and g/z keys work), and some features depend on a compile-time option that is sometimes disabled in the "tiny Vim" that is used for this (text objects, such as "aw" a word, are one of these). You won't get these if you run the real Vi, or if "vi" is some other clone with fewer or different features than Vim, such as nvi or VILE.

And, on the obscure side, while "tiny Vim in Vi mode" obviously doesn't have any features that a full Vim does not, there are a few features of the genuine original Vi that vim lacks. These are documented in :help vi-differences.

3
  • 3
    I'd bet heavily that OP actually has a "tiny vim" vi.
    – Kevin
    Nov 18, 2015 at 22:15
  • you say that on many systems the vi command actually runs vim. So how do I find out if I am really running vi or vim? Jul 9, 2020 at 20:46
  • @firstpostcommenter Well, it'll basically still look like vim - the ~ on the left of the screen will be blue in color, and the version announcement text may still appear on the center of the screen if you start it by itself without specifying a file. If you're very concerned with what editor you run, there are also other vi clones that might be installed instead, and the genuine "vi" is very rare in linux/bsd distributions.
    – Random832
    Jul 10, 2020 at 4:13
4

The Vim FAQ has a well formatted list: https://vimhelp.org/vim_faq.txt.html#faq-1.4

Excerpt from the FAQ:

  • Multi-level undo
  • Tabs, Multiple windows and buffers
  • Flexible insert mode (can use arrow keys in Insert Mode)
  • Macros
  • Visual mode (visually select sections of text)
  • Block operators
  • Online help system
  • Command-line editing and history
  • Command line completion (tab completion)
  • Horizontal scrolling (long lines)
  • Unicode and internationalization improvements.
4

Most comparisons give more functionality to Vim than to vi, but there is one exception. There was an "open" mode in vi, and Vim doesn't really have this mode.

Open mode is a single-line mode that was used back in the day with terminals that didn't have electronic displays, i.e. teletypes, letterprinters, and the like, and also with displays where the cursor remains only at the bottom.

I know there is documentation out there that says Vim simulates open mode, but my experience is that it doesn't. For I have seen it used with vi with my own eyes, and I have never seen Vim do it. It seems that Vim just uses the open command simply to open and edit a file in visual mode. I do believe that Vim's official documentation states that it does not support open mode.

2
  • I have ex-vi.sourceforge.net installed, which is a port of the original Vi. How do I start this open mode? The manpage mentiones it when talking about ^R, but gives no other help. :open some/file returns open: No such command from open/visual.
    – muru
    Apr 4, 2016 at 15:46
  • @muru Q to enter ex mode, then open. z to show the context of the current line once you're in open mode. To back out, Q then vi.
    – Antony
    Jun 21, 2016 at 3:00
0

I think it is very hard to make the comparison, because of the changes in vi that have happened over time.

When I was in college, I used plain-vanilla vi on a dumb terminal (and also on a terminal emulator on a Mac) that connected to mainframes using System V. You can't even find that any more.

But I'm not even sure that was true vi. About that time there were lots of clones and ports made because vi wasn't open-source at the time. And when vendors made clones, they added features that weren't in vi. The history is kind of convoluted. You can read it on Wikipedia and elsewhere.

So if you weren't using certain vendors/hardware, you weren't using vi, but something like vi.

But I do recall vi (or the clone I was using) being very minimalist in its interface (no colors, no INSERT labels, no mulitple undos, etc.) yet powerful in what it could actually accomplish. Very practical.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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