When Vim launches, files are opened in command mode by default. This means that you can move around and edit the file, but cannot insert new text.
All alphanumeric keys in this mode are equal to commands, and pressing them will not display their value on the screen. For example, pressing the letter w will move the cursor one word forward.
To type text, you must be in insert mode. To switch to insert mode, press the i key. Now you can type text into a file.
To switch back to command mode, press the ESC button.
How to Save Changes in Vim
Vim Save and Quit Command
To save a file and exit Vim:
1. Switch to command mode by pressing the ESC key.
2. Press : (colon) to open the prompt bar in the bottom left corner of the window.
3. Type x after the colon and hit Enter. This will save the changes and exit.
Vim Save And Quit The Editor Command
Alternatively, a command that will also save a file and exit the text editor is:
:wq
In which case the w stands for write (=save) and q stands for quit.
Comments
Post a Comment