Vim 基本命令(doc)

所有的命令所在位置:/usr/share/vim/vim72/doc;

可以通过 find /usr/share/vim -name help.txt (其中一个文档)

1.到某一行

*G*
G Goto line [count], default last line, on the first
non-blank character |linewise|.  If 'startofline' not
set, keep the same column.


*<C-End>*
<C-End> Goto line [count], default last line, on the last
character |inclusive|. {not in Vi}


<C-Home> or *gg* *<C-Home>*
gg Goto line [count], default first line, on the first
non-blank character |linewise|.  If 'startofline' not
set, keep the same column.

例如跳转到第三行,3G 或者3gg. 

2.复制

["x]y{motion} Yank {motion} text [into register x].  When no
characters are to be yanked (e.g., "y0" in column 1),
this is an error when 'cpoptions' includes the 'E'
flag.


*yy*
["x]yy Yank [count] lines [into register x] |linewise|.


*Y*
["x]Y yank [count] lines [into register x] (synonym for
yy, |linewise|).  If you like "Y" to work from the
cursor to the end of line (which is more logical,
but not Vi-compatible) use ":map Y y$".

3.黏贴

["x]p Put the text [from register x] after the cursor
[count] times.  {Vi: no count}


*P*
["x]P Put the text [from register x] before the cursor
[count] times.  {Vi: no count}

4.删除

["x]<Del> or *<Del>* *x* *dl*
["x]x Delete [count] characters under and after the cursor
[into register x] (not |linewise|).  Does the same as
"dl".
The <Del> key does not take a [count].  Instead, it
deletes the last character of the count.
See |:fixdel| if the <Del> key does not do what you
want.  See |'whichwrap'| for deleting a line break
(join lines).  {Vi does not support <Del>}


*X* *dh*
["x]X Delete [count] characters before the cursor [into
register x] (not |linewise|).  Does the same as "dh".
Also see |'whichwrap'|.


*d*
["x]d{motion} Delete text that {motion} moves over [into register
x].  See below for exceptions.


*dd*
["x]dd Delete [count] lines [into register x] |linewise|.


*D*
["x]D Delete the characters under the cursor until the end
of the line and [count]-1 more lines [into register
x]; synonym for "d$".
(not |linewise|)
When the '#' flag is in 'cpoptions' the count is
ignored.

5.替换

["x]c{motion} Delete {motion} text [into register x] and start
insert.  When  'cpoptions' includes the 'E' flag and
there is no text to delete (e.g., with "cTx" when the
cursor is just after an 'x'), an error occurs and
insert mode does not start (this is Vi compatible).
When  'cpoptions' does not include the 'E' flag, the
"c" command always starts insert mode, even if there
is no text to delete.


*cc*
["x]cc Delete [count] lines [into register x] and start
insert |linewise|.  If 'autoindent' is on, preserve
the indent of the first line.


*C*
["x]C Delete from the cursor position to the end of the
line and [count]-1 more lines [into register x], and
start insert.  Synonym for c$ (not |linewise|).

[count] + operator+[count]+motion

{motion} A command that moves the cursor.  These are explained in
|motion.txt|.  Examples:
w to start of next word
b to begin of current word
4j four lines down
/The<CR> to next occurrence of "The"
This is used after an |operator| command to move over the text
that is to be operated upon.
- If the motion includes a count and the operator also has a
 count, the two counts are multiplied.  For example: "2d3w"
 deletes six words.

如果要彻底的了解完全用法,请vi -->:help



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值