How Vim Is Different From Vi?


Vi is a command-line text editor originally developed for Unix operating system. You can find it installed on almost any Unix-like operating systems including Linux, BSD, etc. Vi was originally written by Bill Joy in 1976.

Vim is the short form of Vi Improved which means Vim is the superset of vi that has some extra features. It is highly customizable and extensible provides great control to users over the editing environment. Depending on the distribution it may be or may not be installed in your system. Vim is authored by Bram Moolenaar and released to the public in 1991.

Now by executing the given command in your terminal you can check whether Vim is installed in your system or not.

vim

If it is installed in your system then it will open with an introductory page of vim otherwise it displays command ‘vim’ not found and will provide you the suggestions of packages that you can install.

Installing Vim on Linux

You can use one of the given commands to install Vim in your system.

To install Vim on Debian, Ubuntu, or Linux Mint use –

sudo apt install vim -y

If you are using RHEL or CentOS use –

sudo yum install vim -y

To install in Fedora Use –

sudo dnf install vim -y

By installing the Vim package you can start using editor by executing the vim command.

Operating modes

Both of them operates in two basic modes  –

1. Command mode –

This is the default mode of Vi or Vim. In this mode, commands are given to accomplish different operations on files such as moving cursor, deleting text, saving the content of the file, etc.

2. Insertion mode –

This is the mode in which every character typed are get added into the file. To get into insert mode from command mode, you need to press i. For exiting from insert mode and enter into command mode you need to press the Esc key.

Apart from these two modes, there are some other modes of operation are visual mode, select mode, ex mode, etc.

Limitation of Vi editor

As a part of POSIX standardization Vi have some restrictions. For example in the original implementation of Vi had limits on line-length and file size. This was not a limitation in Vim.

The features of Vim

As discussed above vim is an improved version of vi which includes several additional features. Some of them are given below –

  • Vim includes support for different programming languages like c/c++, python, Perl, etc by adding features such as syntax highlighting, code folding, etc.
  • Vim is ported to a much wide range of operating systems than vi.
  • It integrates with cscope.
  • Vim can edit files inside a compressed archive.
  • It allows the screen to be split for editing multiple files.
  • Vim includes a built-in diff tool called vimdiff used for comparing files.
  • Vim can be scripted using vimscript or using a scripting language such as Perl, Python, shell script, etc.
  • It includes the support for plugins and provides the finer control over configuration and startup files.
  • Vim can be used to edit files using network protocols like SSH and HTTP.

Conclusion

Everything is common in both the editors in fact when you run vi command by default it opens the improved version of vi i.e. Vim in many of the Linux distributions.

 

 

 

 

 

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.