Vim

From XennisWiki
Jump to: navigation, search

Vim (a contraction of Vi IMproved) is a clone of Bill Joy's vi text editor program for Unix. [...] Vim is designed for use both from a command-line interface and as a standalone application in a graphical user interface. Vim is free and open source software and is released under a license that includes some charityware clauses, encouraging users who enjoy the software to consider donating to children in Uganda. (Wikipedia)

Installation

Arch Linux

pacman -S vim

Debian

apt-get install vim

Configure

The configuration file: ~/.vimrc.

Comment

"Example comment

Set tab with

Set it to 4

set tabstop=4
set shiftwidth=4

Maybe set expand of tabs too

set expandtab

Syntax highlight

syntax on

Usage

Use key i to switch to insert mode and as a result you will see a -- INSERT -- in the bottom line. Use key ESC to switch back.

Command Description
wq Save (:w) and quit (:q)
q! Quit (:q) without saving current changes
dd Delete line
yy Copy line (use p to paste)
u Undo last change
?<query> Search for <query> (use n to jump to next result)
m<line-number> Move current line to line <line-number>
cw Change current word

External links