Vi

Uit DeVliegendeWiki

Ga naar: navigatie, zoeken

Vi is the standard editor under Unix. It is originally programmed by Bill Joy in 1976. It is very powerful though archaic. It is the most universally available editor, available on all regular platform (Linux, Unix, Apple, Windows, and probably lots of other platforms as well).

  • Vi has two modes of operation: normal mode and insert mode. In normal mode, you can issue commands. You can always get to normal mode through pressing ESC, and always get to insert mode through pressing i.
  • There exist some alternative versions: Vim (Vi Improved), Elvis, Vile, and especially: GVim (Graphical Vi Improved). I recommend GVim where available.

Inhoud

File operations

Command Key sequence Comments
Open file  :e file You have to provide a file name. Without file name, you get an error, rather than an empty window
Close file  :close
  • When multiple files are open, it closes the current file.
  • You cannot close the last file
Open new tab  :newtab Probably an Vim/GVim command
Save file and exit ZZ

:x

:wq

As you see, there are at least five ways to save and exit. I think I prefer :w, and remember it as write
Save file, without exit :w

:w!

Fix arrow keys

In insert mode doen de pijltjestoetsen het soms niet meer. Zie http://linuxblog.pansapiens.com/2007/10/31/fixing-the-arrow-keys-in-vim/ om dat op te lossen.

Regelnummers weergeven

:set number

Versions & Installation

GVim Portable might be an interesting version of Vi for Windows: You can carry it on an USB stick with you, including configuration file. You can just execute it without installing first. See GVim Portable home page and GVim Portable download page at SourceForge for details.

Persoonlijke instellingen