command lab
  • TOP
  • vim

  • [Vim practice] Commands related to file operations (save/end/open)

[Vim practice] Commands related to file operations (save/end/open)

File operations such as saving a file and creating a new file are required to edit text. Here you can practice the basics of vim file operations. Please refer to the commands at the bottom as they are explained individually.

practicing vim

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

Open file

This command opens an existing file. Or, if the specified file name does not exist in the existing file, it will be newly created. Note that the file is not added unless you save it when you create a new file.

Open file (New) :e [File name or path you want to open]


Command to save the file. It is easy to remember w of “:w” as the initial letter of write. Note that people who are new to vim may be tempted to unintentionally press “ctrl + s” to save. If it is simply “:w”, it will be saved by overwriting with the currently opened file name, but if you specify a file name such as “:w test.js”, it will be saved with another name.



This command terminates vim mode. It’s good to remember the acronym for “quit.” This command returns you to the terminal (command prompt). However, if you try to exit without saving the file, the message “No write since last change” will be displayed and you will not be able to exit, so you must add “!” to the end, as described below.

End :q

Force termination (terminate without saving)

If you haven’t saved the changes, the normal “:q” command gives a message and you can’t exit, but at the end of this “:q!”! You can forcibly end by adding.

Force quit (quit without saving):q!

Rename file

If you specify a file name after “:f”, the command will change to that file name. For example, it looks like “:f test.html”. This command is easy to remember if you keep in mind that the initials of “file” are taken.

Change file name :f [file name]

Save and exit

This command combines “:w” for saving and “:q” for ending. It seems easy to remember if you write and quit.

Save and exit :wq

Stop vim

This command is used when you want to suspend vim. After suspending vim with this command, you can immediately return to the state where it was suspended by typing “fg” in the terminal (command prompt).

Stop vimctrlz

Resume suspended state

The command is typed on the terminal (command prompt) after interrupting vim with “ctrl + z”. It returns to the state of vim when it was interrupted.

Resume suspended state fg



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