Vim is a text-editor for the console, with 2 modes.
$ vim file.txt
When you start vim, you are not initially in the edit mode.
The easiest way to enter the edit mode at the beginning is
to press the Insert
key.
some text ~ ~ ~ -- INSERT --
You can also press the key i
to enter the edit mode,
which is easier to access on the keyboard.
In edit mode, you can edit the content, with all the keys of your keyboard.
This text-content is in the utf-8 format, by default.
Exit the edit mode with the Escape
-key, and you will
be in the command
-mode again, like at the beginning.
In command-mode
, you can do copy-paste
commands for example.
These commands are launched by keys that usually represent the initial letter from the name of this command.
You can move the cursor with the arrow-keys, or some commands, to navigate into the text, or the source-code.
In command-mode
, you can start to high-light some text by
pressing the v
-key, which will start the visual-mode
.
some text ~ ~ ~ -- VISUAL --
Then move with the arrows until your destination, and press the command
y
(yank), which will place the text into the copy-buffer.
Move again with the arrows, and place this text at the position of the cursor
with p
.
Some commands to navigate, e
to jump until the end of the next
word, gg
to jump until the beginning of the file, and G
at the end.
At the end, you can type :w
to save, and :q
, to
quit (in "command-mode").