key description
iinsert before cursor
Iinsert at line start
aappend after cursor
Aappend at line end
onew line below
Onew line above
vvisual mode
Vvisual line
Ctrl-vvisual block
gvreselect last visual
Rreplace mode
Escnormal mode
key description
h j k lleft down up right
w / Wnext word / WORD
b / Bprevious word / WORD
e / Enext word / WORD end
0first column
^first non-blank
$end of line
ggtop of file
Gbottom of file
%matching pair
{ / }previous / next paragraph
key description
/patforward search
?patbackward search
n Nnext/prev result
* #search word under cursor
f / Ffind char forward/backward
t / Tuntil char forward/backward
; / ,f/t repeat / reverse
:%s/a/b/g replace in whole file
:%s/a/b/gcreplace in whole file (confirm)
:%s/\Ca/b/gcase-sensitive match
:s/a/b/greplace in current line
key description
ddelete
cchange
yyank
=format
key description
iw awinner/a word
i" a"quote
i' a'single quote
i( a(paren
i{ a{braces
i[ a[bracket
it attag
ip apparagraph
例如:
key description
ciwchange word
di(delete inside ()
ya"yank around quotes
key description
xdelete character (forward / backward)
rreplace single char
dddelete line
ccchange line
Cchange to end of line
yyyank line
p / Ppaste (after / before cursor)
Jjoin lines
.repeat last change
key description
<C-w>delete previous word
<C-u>delete to line start
<C-r>"insert from register
<C-o>execute one normal command
key description
ddelete
cchange selection (insert mode on all)
yyank
> / <indent / outdent
=auto-indent
r{char}replace all selected with char
I / Ablock insert at start/end of lines
:auto :'<,'>
oswitch to other end of selection
Key Description
Ctrl-oJump back (older location)
Ctrl-iJump forward (newer location)
``Jump to previous position
gdJump to definition
grJump to references
gIJump to implementions
gyJump to type definition
:jumps to view current jump list
Key Description
g;Older change
g,Newer change
giJump to last insert
`.Jump to last edit
:changes to view current change list
key description
maset mark
`ajump exact
'ajump line
``previous jump exact
key description
"ayyyank to register
"appaste register
:regshow registers
:reg to view registers
key description
uundo
Ctrl-rredo
key description
qastart recording
qstop recording
@aplay macro
@@repeat
10@aplay 10 times
key description
zatoggle fold
zo / zcopen/close fold
zO / zCrecursive open/close all nested folds
zR / zMopen/close all folds
zj / zkjump to next/prev fold
zzscroll to center screen
ztscroll to top
zbscroll to bottom
key description
<C-w>h/j/k/lsplit nav
<C-w>vvsplit
<C-w>ssplit
<C-w>cclose windows
<C-w>wcycle to next window
gtnext tab
gTprev tab
command description
:wsave
:xsave and quit
:wasave all
:xasave all and quit
:q!force quit
:e fileopen file
command description
:g/pat/cmdexecute cmd on matching lines
:v/pat/cmdexecute cmd on non-matching lines
:%norm cmdexecute normal command on all lines
:%!cmdreplace buffer with shell output
:!cmdrun shell command
:r !cmdinsert shell output
:w !sudo tee %save current file as root (classic rescue)
syntax on
filetype plugin indent on
set nonumber
set linebreak
set showbreak=+++
set showmatch
set ruler
set visualbell
set hlsearch
set smartcase
set ignorecase
set incsearch
set autoindent
set expandtab
set shiftwidth=4
set softtabstop=4
set smarttab
set undolevels=1000
set backspace=indent,eol,start
if has('win32')
set clipboard=unnamed
else
set clipboard=unnamedplus
endif