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

Bookmarks

You can use for X any letter, e.g. a or S (better use lowercase).
Command Action Description
mX Create a bookmark at the cursor position for X Best use lowercase letters as bookmarks
'X Jump to the line for X
`X Jump to the line and position for X
:marks Lists all bookmarks
:marks a1 Lists bookmarks for a and 1
:delmarks a1 Deletes bookmarks for a and 1 You can use ranges, e.g. :delmarks a-z
:delmarks! Deletes all lowercase bookmarks for this buffer
Source: VIM Wiki

.vimrc

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
endif

Search and Replace

Source: vim.wikia.com

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:
:s/WARNING//n
Source: fandom.com