command lab
  • TOP
  • vim

  • [Practice of vim] Editing commands to remember first

[Practice of vim] Editing commands to remember first

Vim’s editing commands are the first to remember. If you learn it along with the mobile commands introduced in another article, you should be able to use vim in practice for the time being.

If you can move vim freely, coding should be much easier. I don’t think it will work as expected until I get used to it, but I will do my best to learn it.

Practice of editing commands of vim

Press the START button below to enter practice mode.
* Input mode switching ctrl + shift + alt + space
Guide mode
Repeat mode

Switch to edit mode

This command switches from normal mode to edit mode. Even if you say to switch to edit mode in one word, vim has various switching methods. These are the commands that you use a lot, so be sure to remember them.

Move to the beginning of the Go to end of Insert line below Insert line above
Switch to edit mode (before cursor)i
Switch to edit mode (behind the cursor)a
line and enter input mode I
line and enter input mode A
to enter input modeo
to enter input mode O

Command to return to normal mode

Command to return to normal mode. There are many sites that only explain esc, but in fact, you can also switch with “ctrl + [“. I prefer the latter because I can type without leaving the home position. Also, it is necessary to edit the setting file called vimrc, but if you set “jj” as a command to return to normal mode as a recommended setting, it will be possible to switch very smoothly.

Return to normal modeesc
Return to normal mode (press ctrl var)ctrl + [
Return to normal mode (recommended setting)jj

Replace character mode

This command can be replaced without deleting the character on the cursor. It will save you the trouble of erasing characters, so remember it for efficient editing. In the case of single character replacement, the replacement mode ends with the replacement character input, but in the case of multiple character replacement mode, it is necessary to end the mode with esc.

Replace one character on the cursorr
Switch to multi-character replacement modeR
End replace modeesc

Visual mode

This is a command about the visual mode which can be said to be the selection mode. The command to select a row is very frequently used, so be sure to remember it.

Change to visual modev
Change to visual mode and select lineV

Copy paste etc.

Commands related to copy/paste, etc., which are generally called. Yank is almost the same as copy. Note that vim will automatically yank even if you delete it with the d command.

Yank (copy)y
Yank (copy) one lineyy
Delete one character (& Yank)x
Delete (& Yank)d
Delete one line (& yank)dd

Useful motion commands

Introducing the most powerful motion command in vim. Below is a partial list of the ones I often use. If you memorize this motion command, you can realize the merit of vim. Really convenient.

Delete the contents of the Select contents of Delete contents of Yank (copy) the contents of the Yank (copy) the contents of
html tag and enter edit modecit
html tagvit
html tagdit
html tagyit
Delete the “” contents and enter edit modeci”
Select “” contentsvi”
Delete the contents of “”di”
Delete the word on the cursor and enter edit modeciw
Select word on cursorviw
Delete word on cursordiw
Yank (copy) the word on the cursoryiw



The comment will be displayed after approval by the site administrator. Please follow the manners and comment.