How can I learn Vim Editor

7. The editor vi

Next:8. Etiquette Up:Bridging course in computer science at the BerlinSkript Previous:6. The Emacs editor

It is loved and hated among computer scientists. For the loving, the purists, it is considered to be one of the most powerful tools of all, available everywhere, stable like nothing else, and anyone who can use it is simply part of it, at least in certain circles, in others one is shunned. It is hated because it is impossible to learn how to operate it without making a pact with the devil. Written in 1973, almost thirty years old, it lacks any graphical user guidance. Menus or even the mouse are unknown to him. Each entry is made using key combinations that are so cryptic that even acquiring a basic knowledge of Malay languages ​​seems like child's play. Enough polemics. Where does the motivation come from to deal with it anyway?

  • As I said: is available everywhere. It is part of the Unix standard equipment. This means that if no other editor is installed, you will have to switch to that. System administrators in particular cannot avoid it.
  • is really very powerful. If you don't shy away from studying the countless introductions for months and have destroyed various work with a lot of trial and error, you will at some point be able to make the most complex changes in your program sources with a single command. (During the time of acquiring knowledge, however, you are not allowed to do anything else, especially not use any other programs or talk to people, otherwise a phenomenon occurs that I would like to call cognitive interference.)
  • If one takes place(vi improved) used, you have a little more comfort.
  • The main argument for dealing with is that it can easily happen to start it all at once and not find out anymore. This is because some programs use text editors by default. These include, and. This can sometimes be changed by setting the environment variable.

The most important thing to know about using is to know how to exit, both with and without saving any changes to a file. But first about the call:

vi filename (s) With line number the cursor will be right on the line line number positioned. Instead can of course also be called.

It has two different modes commandmode and the Insertmode. After starting you are in command mode. What is entered here is interpreted as a command, not as text. That is certainly very unusual. In most editors you can start entering text right away. With (insert) change to insert mode. Now you can write, but e.g. not wander around in the text with the cursor keys. You can return to command mode with. The most important commands are:

command effect
Change to insert mode
Insert line below
Insert line above
Save the file
Exit the (only after saving)
Save and exit the
Exit without saving
Next file
delete a line
Delete the rest of the line
Delete word on the right
Delete word on the left
Search for search
Repeat the last search
Replace throughout the text xxx by yyy
nGo to line n

Since this introduction is far from exhaustive, here are a few references to vi introductions and references:

Next:8. Etiquette Up:Bridging course in computer science at the BerlinSkript Previous:6. The editor Emacs Author: [email protected]