[Practice of vim] Basic mobile commands you should learn first
For those who are going to learn vim, I will introduce and explain the basic commands of the mobile system that should be remembered first. This site is for learning shortcuts and commands efficiently and intuitively. We also have a function to practice vim commands intuitively. Please use it by all means.
Click here for vim command practice
It is a unique cursor movement command that should be called a symbol of vim. It can be said that this is the first wall to hit when learning the operation of vim. You may think that most people have to move with k or j without using arrow keys (→, etc.), but the biggest advantage of this operation method is that the cursor does not move away from the home position. It means that you can move. It is also a big advantage of vim that most operations can be performed without leaving the home position.
|Move to ↑||k|
|Move to ↓||j|
|Move to →||l|
|Move to ←||h|
Move cursor on display
Many people may find it difficult to hear the movement of the cursor on the display, but this is a command that is required when automatic line breaks are turned on. In the above k and j commands, automatic line breaks are ignored when the number of characters in a line is large, so the following command is required to move the automatic line breaks up and down.
|Move to ↑ on the display||gk|
|Move to ↓ on the display||gj|
Jump to the beginning/end of the line
This command moves to the beginning/end of a line. It is a command that should be remembered as a mast when using vim because it is a command that is often used unexpectedly. The difference between ^ and 0 is that ^ is a command to move to the first character that ignores the indent, and 0 is a command to move to the 0th character including the indent, that is, the first column.
|To the beginning of the line (first character)||^|
|To the beginning of the line (first column)||0|
|To end of line||$|
Move word by word
|Go to beginning of word||w|
|Return to beginning of word||b|
|Go to end of word||e|
|Return to end of word||ge|
Move to beginning/end of file
Command to move to the first and last line in the file. This is also a scene to use unexpectedly, and it is very convenient to remember.
|To the top of the file||gg|
|To the end of the file||G|
Move to specified line
This command allows you to jump to the specified line. There are two ways, one is to enter :: to jump from the command mode, and the other is to jump without entering the command mode. Personally, I prefer commands that start with:. Is it enough to remember who you like?
|Move to line XX||:〇〇 Enter|
|Move to line XX||〇〇G|
The cursor is currently in the center of the screen
This command is a little different from moving and scrolling, and it brings the cursor position to the center of the screen. It is used when you want to see the upper and lower codes. It is a command that is convenient for you to know.
|The cursor is currently in the center of the screen||zz|
Move to a specific character in a line
A command to move to a specific character in a line. When you can type this command freely, the mouse turns out. It can be said that this is a command that cannot be avoided in order to master vim.
|Search one character of 〇 in the forward direction of the line||f〇|
|Repeat one character search in the forward direction||;|
|Repeat one character search in the opposite direction||,|
|Search for 1 character in the reverse direction of the line||F〇|
Search string in file
This command works in the same way as the search of ctrl+f usually called in the editor. Since there are commands for forward and backward respectively, it can be said that you are an advanced person of vim if you use them properly depending on the situation.
|Search string in forward direction||/〇〇 enter|
|Search string in reverse direction||?〇〇 enter|
|Repeat string search forward||n|
|Repeat string search in reverse direction||N|
Move to the place where you jumped
This command can be used when you want to go back to where you were just before, when you are jumping for searching or moving lines. The reason why vim is loved is that these commands are provided.
|Return to where you jumped||ctrl + o|
|Go to the place where you jumped||ctrl + i|
Since vim is basically created on the assumption that the mouse is not used, naturally scrolling will also be done with commands. Actually, you can also scroll with the scroll wheel of the mouse, but since it is far from the home position, it is annoying. If you also master scroll commands, you will be able to code at explosive speed without leaving your home position.
|Move up half screen||ctrl + u|
|Move down half screen||ctrl + d|
|Move up one screen||ctrl + b|
|Move down one screen||ctrl + f|
Move changed part
This command returns you to the changed part. vim saves the history of changes, so you can move along the history of changes, which is a very convenient command.
|Go back one place changed||g;|
|Proceed the changed part||g,|