zoukankan      html  css  js  c++  java
  • Vim常用操作-快速删除括号中内容。

    如果你和我一样,希望拥有众多工具,发挥工具最大执行效率,让工作事半功倍的话,我推荐你来使用下 Vim。

    刚接触Vim 会觉得它的学习曲线非常陡峭,要记住很多命令,操作太复杂。所以这个系列的分享,不会教你怎么

    配置它,而是教你怎么快速的掌握它。

    学不会就不要继续学了,直接拿来用就好了。

     

    接下来我们要实现这种效果,快速的删除括号中的内容。

     

    操作步骤:

    1. 按 ESC 进入 Normal 模式,通过 h 左、j 下、k 上、l 右 来控制光标,把光标移动到括

    号中。

    2. 连续按 di( 就可以把括号中的内容删除了。

    刚才连续按下的快捷键,代表的意思是 delete all content inside ( 所以结果字符串为 ()

     

    更多案例:

    比如说有这么个字符串 "testdfat",假设光标停留在第一个 t 位置。

    di":delete all content inside ",结果字符串为""

    dta:delete all content to a,结果字符串为"at"

    dfa:delete all content from current location, until a is found,结果字符串为"t"

     

    高手进阶:

    i 表示 inside,打开 Vim 后,执行 :help object-select 可以看详细介绍。

    This is a series of commands that can only be used while in Visual mode or
    after an operator. The commands that start with "a" select "a"n object
    including white space, the commands starting with "i" select an "inner" object
    without white space, or just the white space. Thus the "inner" commands
    always select less text than the "a" commands.
    These commands are {not in Vi}.
    These commands are not available when the +textobjects feature has been
    disabled at compile time.
    Also see gn and gN, operating on the last search pattern.

     

    相关学习:

    Vim 模式:http://www.cnblogs.com/zeushuang/archive/2012/11/16/2772830.html

  • 相关阅读:
    临时表 Vs 表变量
    發行項帶篩選的合併複製問題之訂閱者更新導致部份數據丟失
    生成创建表的脚本V2.0(PowerShell版)
    PowerShell应用之事务复制
    PowerShell应用之批量还原数据库(支持完整,差异,事务日志)
    一个有意思的问题:如何根据一年中的第几周,查询出它周六和周日对应的日期
    千万级数据的分页
    了解SQL Server触发器及触发器中的事务
    修改表主键字段数据类型(up_ModifyPrimaryColumn)
    The specified CGI application encountered an error and the server terminated the processThe specified CGI application encountered an error and the server terminated the process
  • 原文地址:https://www.cnblogs.com/wubaiqing/p/6763547.html
Copyright © 2011-2022 走看看