Vim

From AdminWiki

Revision as of 00:41, 25 May 2006 by Gullevek (Talk | contribs)
Jump to: navigation, search

VI Improved is a common derivate of the default editor on Unix-like systems. Usually, $EDITOR is also set to vi or vim.

Contents

Package Names

vi is everywhere, but vim is not.

.vimrc examples

Minimalistic Configuration

A quick configuration which you can use to get basic stuff like syntax coloring, ready made to past into your .vimrc:

set nocompatible
syntax on
filetype plugin indent on
set hlsearch
set history=50
set showmode
set showcmd

cabbrev Wq wq
cabbrev W w

colorscheme desert

The desert colorscheme will let you read comments (which are normally dark-blue) also on wrong-configured terminals and looks pretty good elsewhere too.

A more extended Configuration

Basically like the Minimalistic, but adds some minor tweaks like bs=2 to avoid some terminal backspace key issues, a fixed tabwidth of 4 spaces, a shiftwidth of 4, so if you use the '>' keys it will be a tab and not spaces. And of course a function key shortcut for pastetoggle so you can paste in code without getting to strange intends

set nocompatible
set bs=2
set ts=4
set shiftwidth=4
set noexpandtab
set ruler
syn on
filetype plugin indent on
set autoindent
set showmatch
set showcmd
set showmode
set hlsearch
set pastetoggle=<F11>
set nolbr

colorscheme desert

" Show Numbers On/Off
map <F10> :call Number_on_off()<CR>

let number_mode = 0 " 0 = normal, 1 = show number

func! Number_on_off()
        if g:number_mode == 0
                set nu
                let g:number_mode = 1
        else
                set nonu
                let g:number_mode = 0
        endif
        return
endfunc

autointent is something I like, some people hate it if vim automatically intents code.

Personal tools