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 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, who was then a graduate student at the University of California at Berkeley. Later he co-founder 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 that was 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 the 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 obviously “advanced” features. Let now see what are the main differences between them.
One of the best features of the vim editor is multilevel undo, meaning you can undo changes multiple times. If you accidentally delete a line of text, then delete a second line, and then the third line, you can undo each of the four deletes. On the other hand, vi editor does not support multilevel undo.
Certainly 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 type of file being edited. This improvement over Vi comes in handy for programmers using Vim to write/edit code.
GUI / Visual operation
Vim works well at a console, but it can run natively in many GUIs. It is designed for use both from a command-line interface and as a standalone application in a graphical user interface. Vim uses native GUI widgets for scrolling, dividing buffers, and has mouse support. It can also talk to the clipboard.
Vim’s configurations are portable. This means that Vim text editor enables you to import the same configurations on different Linux systems.
Vim support plugins. Plugins extend current features of the Vim. New features can be easily added from 3’rd parties without needing to change 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 Vim editor allows navigation using arrow keys in inset 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 indeed quite a big difference between them. Vim has more of everything. These additional features give Vim an edge over the original Vi editor.