In short, Vim is simply a text editor. Vim is unique and special among others because it’s a command-line text editor. Vim as a text editor is popularly used today because of its ubiquity and efficiency.
The amazing text editor works faster so users don’t waste unnecessary time writing programs. In addition, you have got to love the fact that there are many wonderful features associated with the editor.
How well do you know the key commands in Vim? Certainly, you have got to know how to use some important commands in Vim to enhance and make your coding life easy with the text editor. Every command in this article is concerned with various modes in Vim: command mode, visual mode, and insert mode. Never worry yourself as a beginner, we will give you some top Vim commands to help yourself familiarise with the text editor.
You use the X-command to get rid of unwanted characters.
The CTR-R command is simply used to perform redo.
The A-command is simply used for appending texts at the end.
This gives you the opportunity to place the cursor at the starting point of a text to completely remove the text.
This simply helps to move the cursor two words forward.
Users are allowed to use this command if they just want to save their work and exit the text editor.
This command helps to nullify changes if we later think that the changes ain’t needed.
This zero (0) command is all you need if you want to get to the starting point of a line.
So the dd-command is there for you if you want to delete the line you don’t longer want.
This is different from the command we have explained above.
In short, d2w simply stands for delete 2 words.
This is efficient for putting the cursor behind the formerly deleted text.
Users can use the r-command for replacing a letter.
This is used for making changes until it gets to the end of the word.
The G-command is used for getting to see the bottom of a file.
This does exactly the opposite of what the above command does.
The %-command is at your disposal any time you are looking for a matching bracket. For example, ),], or }.
Most importantly, any time g is globally, you are always free to change “new” for “old“.
This command is used for executing shell commands.
The R-command helps you to replace multiple characters.
This is used for finding the next occurrence.
/backward search n
This is somehow related to the above command but it searches in the opposite direction.
/ backward search N
Users use this command for performing a forward search.
In conclusion, this is an operator for copying texts through the use of v visual mode and p for pasting it.
Use this command if you want to (copy) yank a word.
This command is used for inserting texts after the cursor.
The o-command is used for opening a line below the cursor and activating the insert mode.
This does the opposite of the o-command explained above.
This is simply used for moving a command to the end of a word.
So, if you want inter-switch from one window to another use this command.
The :q-command for quitting the text editor.
Most importantly, there are many modes in Vim so, therefore, the i-command is used for entering the insert mode.
In short, there are different commands users are allowed to use in navigating inside the Vim text editor.
This is used for navigating down.
k-command is called upon when users want to navigate in an upwardly.
This is a small letter L. To sum up, the command here is used for navigating in the right direction.
This is simply used for moving down a half-page.
This is simply the exact opposite of the command described above.
Above all, the term yank in Vim is used instead of the word “copy” but both mean the same thing. So, therefore, users make use of yy-command to yank the current line.
The p-command is there for you to use so you can paste the last thing you have copied at the cursor.
If you want to delete more than a line but let’s say 10 lines. The 10dd-command is used fir deleting 10 lines.
This comes handy for deleting 5 characters ahead of the cursor.
This is so useful for pasting a particular thing 100 times.
This works in a similar way as the “:s/old/new/g” command but it confirms every time before replacing.
It is used for finding the occurrences of “search_term” in the current file.
If you are in a different mode in Vim but you want to change to the command mode, the escape key is used for performing this task.
Maybe you are in the command mode but you don’t know how to switch to the visual mode. You can simply use “v” to perform this task.
This command is used for deleting to the starting point of the file.
Users should use this to delete to the end of the file.
d$-command will help to delete to the end of a line.
The best you can get yourself used to the amazing Vim commands we have carefully described in this article is to try them out. These commands are essential for Vim users to know how to use them all.
via Unsplash Nowadays, it’s important for your business to adapt its brand across all your…
The Magento 2 Layered Navigation extension gives you the opportunity to add flexible navigation to…