Vim Tips

Text Block

gp, gP Put text, ! The cursor is left at the end of the new text.
:registers (or :reg) Get contant of all registers.
" The last place the cursor was resting when you left the file.
"A3yy append 3 lines (from current) to name buffer "a.
_dd delete line, but doesn't replace buffer 1.
gJ Join lines with no space.
masks A-Z are global.
"=38*56p the expression register (=).
* The clipboard register.
ga or :as (:ascii) numeric representation of the character under cursor.
vim `grep -l "some pattern" *.pl` Edit all *.pl files that contain "some pattern".
>% Insert one level indent between matched {}, include {}.
>i{ Insert one level indent between matched {}, exclude {}.
CTRL-Y Insert the character below the cursor.
CTRL-D unindent one level.
0CTRL-D remove autoindent.
CTRL-T insert with "indent" (insert mode).
CTRL-R insert the contents of a register ( with autoindent ).
CTRL-R CTRL-O reg insert the contents of a reg (no autoindent).
CTRL-R CTRL-P reg VIM indent like smartindent.

Motion

gf edit the file whose name is under cursor.
gD find the global definition.

Info

[d list the definitions of the macro.
[D list all definition of the macro whose name is under the cursor.
[I list all lines in the current (and included files), that contain the word under cursor.

Visual Mode

<SHIFT>-vi{ select matching {} pair, excluding the {}.
<SHIFT>-va{ select matching {} pair, including the {}.
U Make the selected text uppercase.
u Make the selected text lowercase.

Multi Window

CTRL-W j move down a window.
CTRL-W k move window up.
CTRL-W t go to the top wondow.
CTRL-W b go to the bottom window.
CTRL-W p go to the previous window.
CTRL-W w go to the next window.
CTRL-W r rotate a window downward.
CTRL-W R rotate a window upward.
CTRL-W x exchange windows.
CTRL-W o only one on the screen. (:on, :only).
CTRL-W q close current window. (:q, :quit).
CTRL-W c close current window. (:clo, :close).
CTRL-W i split and searche first occurrence of the word under cursor.
CTRL-W f split and follows by a :find
CTRL-W ^ split and edit alternative (#) buffer.
CTRL-W n if file name is not specified - blank file (:new)
CTRL-W s split window. (:sp, :split).
CTRL-W + increase current window. CTRL-w 5 SHIFT-+ increase for 5 lines.
CTRL-W - decrease current window.
CTRL-W = make all windows the same height.
CTRL-W _ make current window max size.
:wqall (:wqa) write and quite all files.
:only (:on) only one on the screen.
:argument (:args) list-files.
:all (:sal) open up a windows for each argument.
:split (:sp) split same buffer.
:snext (:sn) split with next buffer.
:sp file_name split with file.
:hide hide buffer.
:unhide make buffer to be visible.
:resize n (:res) resize current window to n lines.
:se (:set) all not default setting.
:set all (:se all) all setting.
:set all& set all options to default.
:sy (:syntax) list all syntax elements.

Buffers

:buffers list of buffers.
:badd file_name add file to the buffer
:bdelete (:bde) delete the buffer
:ball open a window for each buffer.
:bufdo[!] {cmd} Execute {cmd} in each buffer in the buffer list.

Arguments

:ar (:args) list of the arguments (buffers,files).
:arg CTRL-d list all commands that start from 'arg'. (help).
:argadd add file to the arguments list.
:arguments (:argu) list all files.
:argdo[!] {cmd} Execute {cmd} in each buffer in the argument list.

Session

:mksession (:mks) [session_name.vim] create a session file. Default is "Session.vim"
:so session_name.vim restore session session_name.vim
vim -c ":so session_name.vim". load session.
:set sessionoption=buffers,winsize,options,help,blan set the session options.
:options (:optio) list options.