The Daily Awesome Blog Thoughts, stories and ideas.

Vim Tip Of the Day

Undo Change, Redo Change
u, Control + r

Page Down, Page Up
Control + f, Control + b

Jump to End of File

Split screen/open another file
:vs  - split screen      :e  - open another file      

Ctrl + ww  - move from one screen to another
:sp - horizontal split

:tabe - open in a new tab     gt - move from one tab to another

Run shell command in vi
:sh - show command line   Control + D - go back to vi
control-z - will suspend the process and get back to your     shell
fg - will resume suspended vim
ps - list foreground processes

Tab selected text, Repeat last command
Shift + >, .

Jump to End of a curly brace
Shift + %

Visual select, Copy selection, Copy current line
v, gyy, yy

Paste text

Move to the begining of the line and insert mode

Move to the end of the line and insert mode

Search and Replace
Find word under cursor
forward: Shift + 8 (*), back: Shift + 3 (#)

First occurrence on current line, Globally (all) on current line
:s/OLD/NEW, :s/OLD/NEW/g

Forwad, Back
n, N

Between two lines #,#:                 

Every occurrence in file:
:%s/foo/bar/gc Change each 'foo' to 'bar', but ask for confirmation first.

:%s/foo/bar/gci Change each 'foo' (case insensitive) to 'bar'; ask for confirmation.

The g flag means global – each occurrence in the line is changed

Turn off escape chars
%sno/regex/new_text/g or \V

Cut text
cw - word
ci" - delete inside quote
cit - inside tag


m and any of the caps letters

jump to mark