w3resource
gallery w3resource

Vim Commands

 

Transcript

Cursor Movement

Cursor Movement
Word forward / backward w / b
End of current word e
Sentences forward / backward ) / (
Paragraphs forward / backward } / {

Scrolling

Scroll window down <C-E>
Scroll window up <C-Y>
Scroll that cursor is on top of the screen zt
Scroll that cursor is in middle of screen zz
Scroll that cursor is on the bottom of the scree zb

Jumping with the cursor

Changelist :changes
older / newer position in the changelist g; / g,
Jumplist :jumps
back / forward in Jumplist <C-O> / <C-I>

The insert mode

Insert before / after cursor i / a
Insert at beginning / end of line I / A
Add and insert in line below / before o / O
Replace char / Replace mode r / R
Quick command in insert mode <C-O>command
Paste in insert mode <C-R>"

Help

Split screen help :help command
Browse the help:
Follow Link <C-J>
Go back <C-T> or <C-O>

File opening and editing

Open Filename in new Buffer :e filename
goto file, open file under cursor gf

Split screen

Vertical split :vs[plit]
Horizontal split :sp[lit]
change active viewport <C-W> [hjkl] same height/width of viewports <C-W> =

Buffers

show list of buffers :buffers
next / previous buffer :bn / :bp

Visual

Visual mode v
Visual line V
reselect visual selection gv

HTML Template

The following code can be copied and pasted to form the foundation of a basic web page:

<html>
<head>
<title></title>
</head>
<body>
</body>
</html>

Spell checking

toggle spell checking <F12>
next wrong word ]s
previous wrong word [s
add good word to wordlist zg
add wrong word to wordlist zw
show suggestions z=

Copy and Paste

yank, visual select then press y y
Paste before cursor P
paste after cursor p
List of paste registers :registers
clipboard buffer / selection buffer "+ / "*
toggle paste mode CTRL+<F11>

Folding

Open / close fold zo / zc
Toggle fold za

Quickfix list

Quicköx list :cl[ist]
Next / previous quickfix :cn / :cp

Search & Replace

Search current file with expr forward /expr
Search current öle with expr backward ?expr
Move to next / previous match / N
Grep in Vim, uses vimgrep expr file:
Quickfix list for matches s/expr/rep/cgiI
Substitute expr with rep
Options: Conörm, G=all in
line, case (i=ignore, I=Don’t
ignore)
Backreferences: \0 whole match, \1 örst group in \(\)
Character Classes :
any character except new line .
Whitespace character; non-whitespace char sS
digit; hex digit; octal digit dxo
Printable char; word char pw
Alphabetic char; lowercase char; uppercase char alu
Quantiöers:
0 or more; 1 or more; 0 or 1 * / + / =
matches from n to m; exactly n, 0 to m, n or {n,m} {n} {,m} {n,}



Follow us on Facebook and Twitter for latest update.