资讯专栏INFORMATION COLUMN

Vim 快捷键分类速记

Aldous / 1108人阅读

摘要:一直觉得按键不好记,直到最近系统的学了一遍,按增删改查找移动光标滚动生产效率其它分类记忆,才感觉舒坦了。

一直觉得 Vim 按键不好记,直到最近系统的学了一遍,按增(add)、删(delete)、改(update)、查找(find)、移动光标(navigate)、滚动(scroll)、生产效率(productivity)、其它(other)分类记忆,才感觉舒坦了。

add
- basic
    a     append
    A     append at the end of the line
    i     insert
    I     insert at the beginning of the line
- line
    o     append a new line
    O     insert a new line before the current line
delete
- basic
    x     delete a character
    X     delete the character before the cursor
    D     delete to the end of the line
- combo
    d?    delete ?
    dd    delete the current line
    di?   delete inner contents, for example: di>
    da?   delete whole group
update
- basic
    s     substitute a character
    C     change to the end of the current line
- combo
    c?    change ?
    cc    change the current line
    r     replace (overwrite) a character
find
- in line
    f?    find forward in the current line
    F?    find backward
- in file
    *     find the word under cursor
    %     find matching bracket: ( ), [ ] or { }
    /     search forward
    ?     search backward
    n     find next
    N     find previous
    [Tab  goto defination
navigate
- direction
    h     left
    j     down
    k     up
    l     right
- by word
    w     next beginning
    e     next end
    b     previous beginning
- in line
    0     beginning
    $     end
    _     first non-blank character
- in file
    gg    beginning
    G     end
    :10   goto line 10
- in screen
    H     highest
    M     middle
    L     lowest
- history
    C-o   jump to last cursor position (ctrl-o)
    C-i   jump to next (ctrl-i)
- bookmark
    m?    create a bookmark and assign a key to it
    `?    goto a bookmark
scroll
- by line
    C-y   line down (ctrl-y)
    C-e   line up (ctrl-e)
- by page
    C-f   page down (ctrl-f)
    C-b   page up (ctrl-b)
- locked
    zz    scroll the line with the cursor to the center of the screen
    zt    scroll the line with the cursor to the top
    zb    scroll the line with the cursor to the bottom
productivity
- select
    v     select
    V     select rows
    C-v   select block (ctrl-v)
- copy
    y?    yank
    yy    yank the current line
- paste
    p     paste after
    P     paste before
- undo/redo
    u     undo
    C-r   redo (ctrl-r)
- replace
    :s/old/new        replace in the current line
    :s/old/new/g      replace all in the current line
    :10,20s/old/new/g replace all in between line 10 and 20
    :%s/old/new/g     replace all in the file
    :%s/old/new/gc    replace all in the file with confirmation
- indent
    >>    indent the current line
    <<    unindent the current line
    >iB   indent in-block code
    
- macro
    q?    start recording a macro and assign a key to it
    q     stop recording
    @?    playback a macro
    @@    replay previously played macro
- misc
    .     repeat last command
    10x   remove 1 character, repeat 10 times
    C-n   auto-complete (ctrl-n)
    ~     invert the case of selected text
    J     join the next line
other
- quit
    :q    quit
    :wq   write and quit
    :q!   quit without saving changes
- tab
    :tabe open file in a new tab
    :tabn next tab
    :tabp previous tab
- regex
    in regular expressions you must backslash the character +
    v    reduce backslashing
- misc
    :e    new
    :o    open
    :w    write
    C-z   goto console (ctrl-z)
    C-g   show current status (ctrl-g)
    :! ?  execute an external command
    :h ?  get help info about ?

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/24920.html

相关文章

  • 你与专家的差距就在于如何管理知识提高效率

    摘要:随着时间的流逝,这些与自己相关的信息就散落在了各个角落,有的偶尔回头检索,大多数用后即丢弃,最终被遗忘遗失。私链信息目录私链的目标是分类整理存放用户积累的知识信息,帮助用户构建管理自己的知识信息体系。 这是一个信息社会,这是一个数字化时代,移动设备、互联网、信息数字化已经成为人所共知的常识。在这种环境中,你有没有问过自己:属于我的数字化信息都有哪些,都在什么地方呢? 每个人在每天都会生...

    aaron 评论0 收藏0
  • 一个前端开发工程师的Vim跟IDE一样

    摘要:一组就是一个插件,的很多功能都由各式插件实现。与相反到行头到本行的第一个非字符到行尾到本行最后一个不是字符的位置。到逗号前的第一个字符。在当前行查找第三个出现的。工程文件菜单自定义快捷键显示文件菜单自带快捷键显示隐藏隐藏文件在新 这里是我新配置出来的 jaywcjlove/vim-web 一直在打磨中,基本上可以用了。拿出来骗 star 先上图 showImg(https://segm...

    Vultr 评论0 收藏0
  • js速记

    摘要:相关最大的特性就在于直接操纵网页上的节点,从而实现网页的局部刷新而非全局刷新。该回调函数会在送回响应的时候被调用。当然了,如果浏览器不支持对象,会返回,在这时需要进行额外的处理。 前言 马上就要参加一个团队项目进行React的前端开发了。最近正在着手熟练React语法,然后发现本质上还是建立在对javascript的深刻理解上。市面上在js基础上封装出了非常多优秀的车轮,其中最被新手广...

    MageekChiu 评论0 收藏0
  • Vim实战指南(二):光标移动技巧

    摘要:原文地址实战指南二光标移动技巧提升的打字效率的一个技巧就是快速移动光标。或许你觉得这不值一提,用或者上下左右也能移动,不过相信我,我下面要介绍的移动光标技巧绝对物超所值。 原文地址:Vim实战指南(二):光标移动技巧 Introduction 提升Vim/vi的打字效率的一个技巧就是快速移动光标。或许你觉得这不值一提,用hjkl或者上下左右也能移动,不过相信我,我下面要介绍的移动光标技...

    binaryTree 评论0 收藏0

发表评论

0条评论

Aldous

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<