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

  • 相关阅读:
    向cmd中添加字体的方法
    学生成绩管理系统C++
    立即抢注我的免费1T云空间
    js原型
    step3 . day8数据结构之算法
    代码练习中的bug及修改方法
    step3 . day7数据结构之二叉顺序数的创建和二叉树的栈形式遍历
    step3 . day6数据结构之非线性表 满二叉树和不完全二叉树
    step3 . day5 数据结构之线性表 栈和队的应用-球钟问题
    step3 . day4 数据结构之线性表 栈和队
  • 原文地址:https://www.cnblogs.com/wubaiqing/p/6763547.html
Copyright © 2011-2022 走看看