VI Tips

Enable Javascript to display Table of Contents.

Useful Commands

When starting VIM you are in the normal mode. Pressing i brings you in the insert mode. Pressing in the normal mode v brings you in the visual mode.
Command Mode Description
D normal Delete all till end of line
U visual Makes selected characters uppercase


syntax on
set tabpagemax=100
set hlsearch
set autoindent
set cindent
set shiftwidth=4
set tabstop=4
set fileencoding=utf8
set tabpagemax=100

" Do not append \n at EOF (important at binary files!)
set nofixendofline

" disable uncompressing of *.gz, *.bz2, etc
let loaded_gzip = 1

" disable displaying of contents of *.tar file
let g:loaded_tarPlugin = 1
let g:loaded_tar       = 1

" Make Vim jump to the last position when reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif

Search and Replace


Count Occurrences

When replacing a string, VIM prints the statistics. When doing a replace with the n-Flag - only the statistics are printed and the replace does not take place: