Vim is the most popular text editor and the most powerful tool in Linux. And in order to master it, one must learn its basic commands.
Vim is one of the most interesting applications that any Linux user must learn at some point. It’s a very old text editor from the early days of UNIX, incredibly powerful and versatile, and fun to use 💻
Even if you’re not a developer or programmer, Vim is still an essential tool that you should learn if you use Linux or BSD on a daily basis.
If you are new to Vim, I recommend these exercises
Vim has two modes: normal mode and insert mode.
In normal mode, you can navigate through a text file and perform actions like delete, copy, paste, search, etc.
In insert mode, you can type or edit text. You can toggle between these modes by pressing the i or esc keys.
So, here are a few basic command line options every Linux user must know.
- Navigate text with the arrow keys (insertion mode)
To escape from insert mode press the Esc key. Then you can use the keys (h,j,k,l) as alternative to the arrow keys
If you want to move by word, you can use
wstands for word ahead while
estands for word end.
If you ever need to delete a sentence without deleting the whole text, you can type
ddwhich deletes the whole line.
Then, there is
Jwhich joins lines if you have a single-line paragraph
The last basic command is
:wqwhich saves your file and closes Vim. To quit without saving press
Use the command
:wto save the file
Vim, like many other Linux applications, has both a command line and a GUI (gvim) version. The GUI version has been included with most Linux distributions for years but many users stick to the more familiar command line version.
This year I used a variety of operating systems (Linux, Mac, RouterOS) and vi/vim is always available. Even on the most limited devices I connect to over ssh.
Vim is often called a "programmer's editor," and so useful for programming that many consider it an entire IDE. It's not just for programmers, though.
You can also use this to edit configuration files and perform several other tasks from in the terminal.
Vim is available in most Linux desktop distributions. It's based on vi which is available on even older or limited systems.
So if you're a Linux user, chances are that you came across vim in your adventures around the terminal.