Vi and Vim are both text editors available in Linux. Vi, with its numerous implementations, is by far the most distributed and used text editor. This tutorial explains the differences between the Vi and Vim editors in detail.
Vi is the universal text editor of Linux. If you know how to use the Vi text editor, you can edit any text file on any mode and version of Linux. Vim is simply an improved version of Vi, but unlike Vi, Vim is not universal.
Depending on your Linux distro, it may be or may not be installed by default. But let’s start with a little bit of history first.
A Brief History of Vi and Vim
Vi traces its origins back to the command line editor called ed. Ed was the original Unix text editor. The original Vi was developed in the late 1970s by Bill Joy, a graduate student at the University of California at Berkeley.
Later he co-founded Sun Microsystems and server as Chief Scientist until 2003. Joy first developed ex as an improved line editor that supported a superset of ed commands. He then developed vi as a “visual interface” to ex.
Vim (a contraction of Vi IMproved) is a text editor written by Bram Moolenaar and first released publicly on November 2, 1991. When he had bought an Amiga computer, he wanted to use the editor he learned on Unix.
Since there was no good Vi for the Amiga, he started with the best available and started improving it. His goal was to imitate Vi. Later new functionality was added, and by version 1.22, Vim included more features than Vi. It was renamed from Vi IMitation to Vi IMproved.
Differences Between Vi and Vim
Vi is the standard text editor. It is the classic and most popular text editor in the Linux family that comes built-in in most Linux distributions.
Vim is a vi-like editor but is more advanced and powerful than the original Vi. It has many features that Vi does not, even features that are not “advanced.” Let’s now see what the main differences between them are.
One of the best features of the Vim editor is multilevel undo, meaning you can undo changes multiple times. For example, if you accidentally delete a line of text, delete a second line, and then the third one, you can undo each of the four deletes. On the other hand, Vi editor does not support multilevel undo.
Indeed, one of the key selling points of Vim over Vi is its syntax highlighting. Vim can be programmed to highlight portions of the buffer in different colors or styles based on the edited file type. This improvement over Vi comes in handy for programmers using Vim to write/edit code.
GUI / Visual Operations
Vim works well at a console, but it can run natively in many GUIs. It is designed for use from a command-line interface and as a standalone application in a graphical user interface. Vim uses native GUI widgets for scrolling and dividing buffers and has mouse support.
Vim’s configurations are portable. In addition, Vim text editor enables you to import the same configurations on different Linux systems.
Vim support plugins. Plugins extend the current features of Vim. New features can be easily added from 3’rd parties without changing the main and official Vim code base.
Flexible Insert Mode
Vi editor does not allow navigation using arrow keys while in insert mode. That makes Vi editor inconvenient to navigate around in insert mode. On the other hand, the Vim editor allows navigation using arrow keys in insert mode.
Vi comes preinstalled with just about every UNIX/Linux system out there. Functionally, Vim is almost a proper superset of Vi. Therefore, everything that is in Vi is available in Vim.
But there is genuine quite a big difference between them. Vim has more of everything. These additional features give Vim an edge over the original Vi editor.
Vim: Most of the shortcomings of Vi and the complexity and bloat of Emacs rolled into one.
In most modern distributions for like at least decade there is Vim installed and alias is made for “vi” command to point to “vim”.