`
oaklet
  • 浏览: 107652 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Vim初级用法速查

阅读更多
Chapter 2. Simple Editing (简单的编辑命令)
Table 2.1. Edit Commands
Text Object Change Delete Copy
1 word cw dw yw
2 words, not counting punctuation 2cW or c2W 2dW or d2W 2yW or y2W
3 words back 3cb or c3b 3db or d3b 3yb or y3b
1 line cc dd yy or Y
To end of line c$ or C d$ or D y$
To beginning of line c0 d0 y0
Single character r x or X yl or yh
Five characters 5s 5x 5yl

Table 2.2. Movement
Movement Commands
←,↓,↑,→ h, j, k, l
To first character of next line +
To first character of previous line -
To end of word e or E
Forward by word w or W
Backward by word b or B
To end of line $
To beginning of line 0

Table 2.3. Other Operations
Operations Commands
Place text from buffer P or p
Start vi, open file if specified vi file
Save edits, quit file ZZ
No saving of edits, quit file :q!

Table 2.4. Text Creation and Manipulation Commands
Editing Action Command
Insert text at current position i
Insert text at beginning of line I
Append text at current position a
Append text at beginning of line A
Open new line below cursor for new text o
Open new line above cursor for new text O
Delete line and substitute text S
Overstrike existing characters with new text R
Join current and next line J
Toggle case ~
Repeat last action .
Undo last change u
Restore line to original state U

Chapter 3. Moving Around in a Hurry (快速移动命令)
Table 3.1. Movement Commands
Movement Command
Scroll forward one screen. ^F
Scroll backward one screen. ^B
Scroll forward half screen. ^D
Scroll backward half screen. ^U
Scroll forward one line. ^E
Scroll backward one line. ^Y
Move current line to top of screen and scroll. z RETURN
Move current line to center of screen and scroll. z.
Move current line to bottom of screen and scroll. z-
Redraw the screen. ^L
Move to home—top line of screen. H
Move to middle line of screen. M
Move to bottom line of screen. L
Move to first character of next line. RETURN
Move to first character of next line. +
Move to first character of previous line. -
Move to first non-blank character of current line. ^
Move to column n of current line. n|
Move to end of word. e
Move to end of word (ignore punctuation). E
Move to beginning of current sentence. (
Move to beginning of next sentence. )
Move to beginning of current paragraph. {
Move to beginning of next paragraph. }
Move to beginning of current section. [[
Move to beginning of next section. ]]
Search forward for pattern. /pattern
Search backward for pattern. ?pattern
Repeat last search. n
Repeat last search in opposite direction. N
Repeat last search forward. /
Repeat last search backward. ?
Move to next occurrence of x in current line. fx
Move to previous occurrence of x in current line. Fx
Move to just before next occurrence of x in current line. tx
Move to just after previous occurrence of x in current line. Tx
Repeat previous find command in same direction. ;
Repeat previous find command in opposite direction. ,
Go to given line n. nG
Go to end of file. G
Return to previous mark or context. ` `
Return to beginning of line containing previous mark. ' '
Show current line (not a movement command). ^G

Chapter 4. Beyond the Basics
Table 4.1. More Editing Commands
Change Delete Copy from Cursor to ...
cH dH yH top of screen
cL dL yL bottom of screen
c+ d+ y+ next line
c5| d5| y5| column 5 of current line
2c) 2d) 2y) second sentence following
c{ d{ y{ previous paragraph
c/pattern d/pattern y/pattern pattern
cn dn yn next pattern
cG dG yG end of file
c13G d13G y13G line number 13

复制内容可以指定剪贴板
Table 4.3. Buffer Names
Buffer Names Buffer Use
1-9 The last nine deletions, from most to least recent.
a-z Named buffers for you to use as needed. Uppercase letters append to the buffer.

作标签
Table 4.4. Buffer and Marking Commands
Command Meaning
"bcommand Do command with buffer b.
mx Mark current position with x.
'x Move cursor to first character of line marked by x.
`x Move cursor to character marked by x.
`` Return to exact position of previous mark or context.
'' Return to beginning of the line of previous mark or context.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics