What is the difference between Vi and Vim?

vim
288,820

Solution 1

Functionally, vim is almost a proper superset of vi. Therefore, everything that is in vi is available in vim.

Vim adds onto those features. Here are a some of the extended vim features:

  • Vim has been ported to a much wider range of OS's than vi.
  • Vim includes support (syntax highlighting, code folding, etc) for several popular programming languages (C/C++, Python, Perl, shell, etc).
  • Vim integrates with cscope.
  • Vim can be used to edit files using network protocols like SSH and HTTP.
  • Vim includes multilevel undo/redo.
  • Vim allows the screen to be split for editing multiple files.
  • Vim can edit files inside a compressed archive (gzip, zip, tar, etc).
  • Vim includes a built in diff for comparing files (vimdiff).
  • Vim includes support for plugins, and finer control over config and startup files.
  • Vim can be scripted with vimscript, or with an external scripting language (e.g. python, perl, shell).

There are many more differences. Refer below sources which are few of good places to start finding out more.

Source: Vim.Org, Vim on Wikpedia.

Hope it helps! :)

Solution 2

"vi" is a text editor from the early days of Unix. It became quite popular and made its way into the Single Unix Specification (SUS) and POSIX, but wasn't freely available until 2002.

So, several free vi-like editors emerged. Vim ("vi improved") is one of these editors. As the name suggest it adds lots of functions to the original vi interface.

In Ubuntu Vim is the only vi-like editor installed by default, and vi actually starts Vim by default.

Other popular vi-like editors available in Ubuntu are, for example, nvi and elvis.

Solution 3

vi editor is the most popular text editor in Linux. We can say it has a simple black and white screen i.e. if you type any command there is no code highlighting, where as vim is improved version of VI it also has features same like vi but it also has code highlighting.

Both have these 4 basic modes:

  1. write mode
  2. command mode
  3. Visual mode
  4. escape mode

Solution 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.

Solution 5

There is indeed quite a big difference between them. I use both nvi and vim daily. Neither of them are perfect, but they're still better than anything else is out there.

Vim has more of everything. In addition to syntax hilighting (when compiled with a support for it) it does automatic conversions of charactersets, line-endings and such. It has multiple ways of numbering lines, which is really convenient. Vim certainly has a lot that speaks for it.

Unfortunately vim breaks the vi philosophy by mixing the editor modes and introducing a vast number of useless and redundant functions. Sure it's convenient at first that you can for example move with cursor keys in insert mode, but it also has some really weird unwanted side-effects (for example the . gets quirky and unpredictable).

Vim (while certainly being IMproved as it claims) is also a bloated, weird and inconsistent mixture of a broken vi and a modeless editor. :P

I still love it, though. And you can fix most of that by tuning you configuration ;D

Share:
288,820

Related videos on Youtube

muru
Author by

muru

Updated on September 18, 2022

Comments

  • muru
    muru over 1 year

    I would appreciate it if someone can let a newbie know what the differences are between vi and vim. I've heard Vim is a successor to vi but whenever I try to open vi in Ubuntu it opens vim instead.

  • phil294
    phil294 about 8 years
    In Ubuntu Vim is the only vi-like editor installed by default - Xubuntu here: vim: command not found. Only vi is available.
  • MycrofD
    MycrofD over 7 years
    +1 for answering the question about why vi opens vim instead. that is what the OP actually is asking.
  • muru
    muru about 7 years
    I'm reasonably certain original vi doesn't have Vim's visual mode.
  • PerlDuck
    PerlDuck about 6 years
    Re "Sure it's convenient at first that you can […] move with cursor keys in insert mode" That's the overall purpose of cursor keys nowadays! We're not in the 80s any more and pressing a down arrow should move the cursor down and not put some ^Bad characters on the screen and make it beep.