[Practical.Vim(2012.9)].Drew.Neil.Tip49 学习摘要

Find by Character

在Vim中快速定位到某个字符的命令为f
这里写图片描述

In this case, the fx command does nothing. Vim searches forward for an occurrence of the “x” character, but no matches are found, so the cursor doesn ’t move. The fo command finds an occurrence of the “o ” character, so the cursor is positioned on top of the first match.
fx命令没有移动光标是因为段落中没有x这个字符,所以光标就不移动。fo命令找到了字符o,所以光标就移动到第一个字符o上。

使用f命令后,使用;可以移动光标到下一个匹配的字符上,如下
这里写图片描述

除此之外,我们还可以使用F t t T ,命令移动光标到特定字符如下:
这里写图片描述
Ff查询方向相反,移动方向相反,t移动到下一个匹配字符的前面,T移动到上一个匹配字符的后面。

这些移动命令可以和删除命令d结合使用,快速删除特定范围的字符,如下:
这里写图片描述
首先命令f,定位到,处,然后要删除从,到结尾除了句号外的所有字符,所以就用命令t.定位到字符.之前。d表示删除。

In general, I tend to use f{char} and F{char} in Normal mode when I want to move the cursor quickly within the current line, whereas I tend to use the t{char} and T{char} character search commands in combination with d{motion} or c{motion} .
快速移动时一般用f{char} 命令或 F{char}命令,更改文本内容时用t{char}T{char}

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值