Vim editor basics in Linux - JohnHau/mis GitHub Wiki
Vim needs no presentations: it is probably the most loved text editor by system administrators, also due to the fact that it is a clone and an improvement of the original Vi, which is included by default in practically all Linux and Unix based operating systems. Vim can be quite intimidating at first, and it has a steep learning curve; learning how to use it, however, can really increase our productivity. In this article we will learn the Vim basics.
In this tutorial you will learn:
How to install Vim Why Vim is a “modal” text editor and what are the Vim modes How to tweak Vim look and feel using the ~/.vimrc configuration file
Installation You can rest assured that Vim, if not installed by default, is available in your favorite distribution repositories, therefore, to install it, all you have to do is to use your favorite package manager. On Debian and Debian-based distributions, among the others, we can use apt-get:
$ sudo apt-get update && sudo apt-get install vim On Fedora, and more generally on all the Red Hat family of distributions, we can use the dnf package manager to perform the task:
$ sudo dnf install vim Running on Arch Linux? In that case, since Vim is included in the Extra repository, installing it is just a matter of running the following command:
$ sudo pacman -S vim
The ones above are only a few examples of how we can easily navigate through the document when in normal mode. In the table below we can see a small number of keys we may want to remember and their effect:
Conclusions In this article we began our first approach with what is probably the most famous and loved text editor on Linux and Unix-based platforms: Vim. We saw how Vim was created as a clone of the original Vi editor, which is installed by default on almost all distributions, we saw why it is called a modal text editor, and what are the modes we can use.
Finally, we saw how to tweak the editor look and feel by writing directives in the ~/.vimrc configuration file. We barely scratch the surface of what we can accomplish by using Vim, since this was meant as a first step guide into the Vim world. We will talk about specific features more in depth in future tutorials. Stay tuned!