Basic Vim Commands -FAQs
How to delete the current line?
To delete the current line first leave the editing/insert mode by pressing Esc the press ‘dd’ to delete the current line.
How to navigate downwards in the editor?
To move downward in the editor first leave the editing/insert mode by pressing Esc the use key ‘j’ to move the cursor down by one line.
I’m not able to write in the editor.
If you aren’t able to modify the file first you have to enter in the insert/editing mode first, Press i or a to enter in the insert/editing mode.
How to save changes in the file?
To save changes in the file enter in command mode and write ‘:w’ command and press Enter to save the changes
How to quit the editor forcefully?
If you have any unsaved changes then you can’t quit the editor normally first, then you have to enter in the command mode and write ‘:q!’ command and press Enter to forcefully quit the editor.
Basic Vim Commands
In this article, we will cover some basic commands in the Vim editor. First, we look at what Linux and VIM editors are and why we use them, followed by basic commands in Vim editor starting from creating/editing a file, different modes, quitting the editor, saving the changes to the file, navigation in the editor, deleting lines, displaying and hiding line numbers, search and replace, and syntax highlighting along with the syntax of commands and screenshots.
Linux
Linux was developed by Linus Torvalds in 1991 as a hobby project. It is an open-source (source code that can be used by anyone freely) kernel that is most popular and widely used in the industry as well as in personal systems. There are various operating systems based on the Linux kernel, some of the popular Linux distributions are Ubuntu, CentOS, Red Hat, Debian, and Kali Linux.
VIM Editor
Vi Editor is a widely used text editor in Unix/Linux systems and is known for its efficiency and flexibility. Vi editor was developed in 1976 by Bill Joy and later in 1991, an improved version of Vi editor was released which is known as VI Improved (VIM).
Basic VIM Commands
- 1. Create/Edit a file
- 2. Changing modes in the Vim editor
- 3. Quit the Vim editor
- 4. Save the changes
- 5. Navigation in Vim editor
- 6. Delete a line
- 7. Search and Replace
- 8. Display Line Numbers
- 9. Hide Line numbers
- 10. Syntax Highlighting