vi/vim
There are a few modes: insert, normal and command mode.
Normal mode (navigation)
Press the esc
button from any other mode. This is the default mode.
Insert mode (typing & editing)
Press i
from the normal mode. This mode allows us to directly insert and edit text — just like a normal text editor.
Command mode (executing commands)
Press :
from the normal mode. This mode allows us to run several commands without leaving the editor. One feature I really appreciate is the ability to run shell commands — see below for more details.
Useful commands
Save (write) file
Quit
Combine write + quit
Quit without saving
Execute shell commands
Note: The symbol %
represents the current filename without any extensions
Examples
Eg. Compile and execute a C program file test.c
(that is currently opened)
Eg. Execute a Python program file test.py
(that is currently opened)
Eg. Change permissions and execute a .sh
(shell) script test.sh
Last updated