Editor „vi“

For those who are not familiar with this very special editor here is a summary of the most important features you need to know. Otherwise you will despair. It took me over 20 years to cotton up to it somehow. This short summary explains only the basic essentials (of the about 350 vi commands) you need to know.

The vi editor works similar to an old typewriter and it has two modes: the command mode and the edit mode. It starts in the command mode if you open an existing file and in the edit mode if you open a new, empty file. You can navigate around with the cursor keys in both modes.

Command mode

^              Go to the beginning of the line.
$              Go to the end of the line.
dd             Delete the current line.
d$             Delete until the end of the current line.
x              (cross-out) Delete the character at the current
               cursor position.
u              Undo.
.              (dot) Repeat the last command.
:w filename     (write) saves the editor's buffer content to the
               file filename.
:wq filename    (write & quit) Saves the editor's buffer content to
               the file filename and closes the vi editor. If the
               filename is omitted it is saved in the current file.
:q!           (quit strong) Closes the editor without saving.

The following commands will switch to the edit mode:

i   (insert) Inserts your entries left to the cursor until
    you quit the edit mode.
o   (open a new line) Inserts a new empty line below the cursor
    and jumps to the beginning of this new line.

Edit mode

[ESC]        Switch back to the command mode.
[DEL]        Delete the character to the right of the cursor.
[BackSpace]  Delete the character to the left of the cursor.
[ENTER]      Go to to beginning of the next line.
[HOME]       Go to the beginning of the line.
[END]        Go to the end of the line.

Schreibe einen Kommentar