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
ge / gEprev 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
g* g#partial word search
f / Ffind char forward/backward
t / Tuntil char forward/backward
; / ,f/t repeat / reverse
:s/a/b/greplace in current line
:%s/a/b/gcreplace in whole file (confirm)
:%s/\Ca/b/gccase-sensitive match
:%s/\ca/b/gccase-insensitive match
key description
ddelete
cchange
yyank
> / <indent / outdent
=format
gu / gUlowercase /uppercase
examples:
key description
dwdelete word
ciwchange inner word
yyyank line
dddelete line
ccchange line
d$delete to EOL
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
x / Xdelete character (forward / backward)
rreplace single char
dddelete line
ccchange line
Cchange to end of line
yyyank line
p / Ppaste (after / before cursor)
~toggle case
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 :'<,'>
oswap visual endpoint
key description
Ctrl-ojump back
Ctrl-ijump forward
gdjump to definition
gijump last insert
g;older change
g,newer change
`.jump last edit
key description
maset mark
`ajump exact
'ajump line
``previous jump exact
''previous jump line
key description
"ayyyank to register
"appaste register
:regshow registers
key description
uundo
Ctrl-rredo
key description
qarecord macro
qstop
@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
zzscroll to center screen
ztscroll to top (top)
zbscroll to bottom (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
:q!force quit
:wasave all
:xasave all and 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
:%!cmdmodify with shell command
:!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 textwidth=100
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