vim的自动排版,剪切与拷贝任意区域方法

1,排版 

在命令行模式下,

首先使用“gg”将光标移动到文档开头,

然后使用“v”切换到可视模式,滚动鼠标滑轮,全选内容,

最后使用“=”。

既可完成整个文档的自动排版。



2.剪切和删除 

 

在命令模式下

首先在要标识的开始化敲入命令mx,x可以是任意字母,vim区别大小写,最好用小写,在vim和vi中通用。
'x: (Apostrophe.) Moves the cursor to the first character of the line marked by x.
`x: (Backquote.) Moves the cursor to the character marked by x.
``: (Backquotes.) Returns to the exact position of the previous mark or context after a move.
'': (Apostrophes.) Returns to the beginning of the line of the previous mark or context.、
将光标移动到目标处。
使用d'y命令(d处可以是所有VI命令)。

于是得到利用书签作cut/copy详细步骤:

Cut and Paste:

  1. Place the cursor at the beginning of the block you want to CUT.
  2. Mark it with md
  3. Go to the end of the block.
  4. Cut it with d'd
  5. Go to the new location that you want to PASTE those text.
  6. Press P.

Copy and Paste:

  1. Place the cursor at the beginning of the block you want to COPY.
  2. Mark it with my
  3. Go to the end of the block.
  4. Copy it with y'y
  5. Go to the new location that you want to PASTE those text.
  6. Press P.

The name of the mark used is related to the operation (d:delete or y:yank).

 

第二种是可视化模式V,只能用键盘而不是鼠标来移动光标。

Cut and paste:

  1. Position the cursor where you want to begin cutting.
  2. Press v (or upper case V if you want to cut whole lines).
  3. Move the cursor to the end of what you want to cut.
  4. Press d.
  5. Move to where you would like to paste.
  6. Press p to paste after the cursor, or P to paste before.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值