Difference Between Vim and Vi

UNIX has a wide range of editors that can manipulate the content of text files. These are line editors, such as ed and ex, and then there as screen editors, such as vi, vim and Emacs. Vi is the standard and the original full-screen text editor of the Linux family which was originally designed for UNIS systems. Vim is an enhanced version of the vi editor written and maintained by Bram Moolenaar. Vim means ‘vi improved’.  Vim commands and their syntax are fully compatible with vi. We look at some key differences between the two.

What is Vi?

Vi is the original standard UNIX full-screen text editor that processes the content of text files, whether these files contain data, source code, or sentences. It is the classic and most popular text editor in the Linux family that comes built-in with the UNIX operating system. Vi editor has been around almost since the beginning of UNIX and it has changed very little. Over time, it made its way into the SUS (Single UNIX Specification) and POSIX, but was only made available in 2002. Vi is short for “visual editor” and is available in nearly identical form on every UNIX system. The standard UNIX system text editor was ‘ed’ before Vi was developed. The ed line editor made it tough to see the context of your editing. So, a superset of ed was developed called “ex” which brought in a display-editing facility that allows you to work with full screen, not just a line. All commands working in ex editor also work in the Vi editor.

What is Vim?

Vim is a cloned version of the original Vi editor or you can say, a more improved and advanced version of Vi. Hence, the name vi improved, or in short, Vim. The Vim editor is a highly configurable and rock stable text editor built to work on text editing more efficiently. It is an enhanced version of the vi editor written and maintained by Bram Moolenaar. In most modern systems, vi has been replaced by vim. Vim is a powerful text editor and perhaps the most widely used vi clone with additional features beyond those provided with vi. You can make some complex edits fairly easily and quickly with vim, once you know how vim works. Vim, however, is not a text formatting program; rather, it is a sophisticated text editor primarily used to write code, short notes, and input to a text formatting system. It provides so many ways to accomplish just any specified editing task through a subset of commands which you need to learn to master vim.

Difference between Vim and Vi

Basics 

– Vi is the standard text editor originally designed for the UNIX operating system. It is the classic and most popular text editor in the Linux family that comes built-in with the UNIX operating system. It is the universal text editor of Linux which has been around almost since the beginning of UNIX and it has changed very little since then. Vim, short for Vi Improved, is a vi-like editor but is more advanced and powerful than the original vi. Vim is a highly configurable and rock stable text editor built to work on text editing more efficiently.

Multilevel Undo 

– Vim is one of the most full-featured vi-style editors anywhere. 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. It keeps a tab on the changes you made in the current session. Vi editor, on the other hand, does not support multilevel undo and it can only undo the last command.

Syntax Highlighting 

– One of the key selling points of vim over vi is its syntax highlighting. Vim is a powerful text editor that can be programmed to highlight its syntax in different colors. Its syntax formatting relies heavily on the use of color which fully appreciates the power of color in defining context. If you edit a file with a formal syntax, such as a programming language, you can see text in different colors, all determined by color and syntax. Vi editor does not have this syntax highlight feature.

GUI 

– One of the Vim’s noticeable enhancements is the graphical user interface. Traditionally, Vim runs inside the terminal, with no graphical user interface (GUI). Today, Vim has its own GUI version called ‘gvim’ which provides a bridge into the world of Vim. GVim offers robust and extensible GUI functions and features. The main advantage of using a GUI-based text editor is that you can use a mouse to select menus, highlight text, cut and copy text, and run special plug-ins. One of the downsides of vi editor was the lack of a GUI, which became the ultimate trump card for the vim editor.

Vim vs. Vi Editor: Comparison Chart

Summary of Vim vs. Vi Editor

In a nutshell, vim is the modern improved version of the classic vi editor, but not quite as powerful as the Emacs. Vim is a vi-like text editor and so much more. One of Vim’s greatest selling points is its syntax highlighting feature which allows you to see text in different colors. Although Vim started as a console, non-graphical text editor, it now has graphical versions too, something the original vi editor lacks. Other features of Vim include a horizontal screen scroll mechanism, support for programming tools, access to command line history, building extensions and macros, etc. These additional features give vim an edge over the original vi editor.