Website of latouche

[home] [Computers and networks] [tips]

Vim configuration

This page aims at referencing the useful configuration options for Vim. Don't hesitate to mail me others, I'll be happy to add them.

Where to configure

For all users, the config file is /etc/vim/vimrc. If you want a particular configuration for you, modify your .vimrc

It is also possible to test each option in the command line.

Visual aspect

With syntax on, the syntax coloration will be activated. Combine this with filetype plugin on to have a coloration more suitable to the file being edited.

The coloration obey to a color scheme that can be modified with the colorscheme command.

Page layout

If you want the file being autoindented will typing, use filetype indent on. The indentation will be adapted to the syntax off the code (XML, C, ...).

Autoindented can be desactivated (useful when pasting a text) with set noautoindent and then reactivated with set autoident.

The comportement of Tab can be modified with tabstop, softtabstop and shiftwidth.


To search a document, the usual way is to press / or ?, the type the text to search and press Enter. Thsi comportement can be modified with set incsearch (which make Vim searching will typing) and set ignorecase.


The mouse can be used in different modes via set mouse=mode, with mode one (or a mix) of the followings:


With the command map it is possible to create shortcups.

The following exemple will make the current file by using the F3 key

map <F3> :make %:r<CR>


Here is my .vimrc:
" viewable colorsheme for my urxvt
colorscheme peachpuff
syntax on
filetype indent on
filetype plugin on

" set tabs to 4 spaces
set tabstop=4
set softtabstop=4
set shiftwidth=4

" search while typing
set incsearch
" ignore case in search
set ignorecase

" export to HTML with CSS
let html_use_css = 1

Last update: 2007/11/18