博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
vim常用快捷键及设置
阅读量:4137 次
发布时间:2019-05-25

本文共 1607 字,大约阅读时间需要 5 分钟。

  • 折叠相关
  • 快捷键:

    zfap (F-old creation);

    zo (O-pen a fold);

    zc (C-lose a fold);

    zr (R-educe the folding);

    zm (folds M-ore);

    zR (R-educes folds until there are none left);

    zM (folds M-ore and M-ore);

    zn (quickly disable the folding);

    zN (brings back the folding as it was);

    zi (toggles between zn and zN,有时可能特别有用);

    zd (delete a fold  )

    命令及设置:

    :set foldcolumn=4 (show a small column on the left of the window to indicate folds)

    :mkview (save the folds when abandon a file. This will store the settings and other things that influence the view on the file.);

    :loadview (load the view again).

    :set foldmethod=indent (根据缩进量进行折叠,一般用于结构化文档,如编程语言)

    :set foldlevel=3 (与:set foldmethod=indent结合用。all folds with three times a 'shiftwidth' indent or more will be closed. foldlevel=0等同于zM,foldlevel=最大值等同于zR)

    :set foldmethod=marker (适用于源代码,会对根据源代码内容进行折叠并将内容进行总结显示。)

     

  • 小修改
  • 快捷键:

    dw (deletes a word.删除n个单词用dnw );

    daw (删除整个单词,与dw的区别是dw不删除单词在光标之前的部分)

    yw (yank a word,拷贝n个单词用ynw )

    yaw (拷贝一个单词,与yw的区别是yw不拷贝单词在光标之前的部分)

    d$ (删除至行尾,等同于D)

    w (将光标向后移动一个单词,移动n个单词用nw )

    ctrl+v(块操作)

    shift+v(行操作)

  • 分割窗口
  • 快捷键:

    CTRL-W H (将当前窗口移动到最左边)ctrl+v(块操作)

    CTRL-W L (将当前窗口移动到最右边)ctrl+v(块操作)

    CTRL-W J (将当前窗口移动到最下边)ctrl+v(块操作)

    CTRL-W K (将当前窗口移动到最上边)ctrl+v(块操作)

    CTRL-w n +/- (垂直方向窗口大小增大/减小n行)

    CTRL-w n >/< (水平方向窗口大小增大/减小n行)

    命令:

    :qall (退出所有窗口)

    :wall (保存所有窗口的修改)

    :wqall (保存并退出所有窗口)

    :qall! (强制退出所有窗口)

    :qall (退出所有窗口)

    另外,vim -o one.txt two.txt three.txt表示水平多窗口打开多个文件;vim -O one.txt two.txt three.txt表示垂直多窗口打开多个文件。

    --------

    :tabedit anotherfile(新建一个tab页编辑文件anotherfile)

    :tab split(新建一个tab页编辑当前文件)

    :tab help gt(新建一个tab页打开gt的帮助文档)

    快捷键gt(Goto Tab)用于在tab页之间切换,快捷键ngt表示切换到第n个tab页。

转载地址:http://zuavi.baihongyu.com/

你可能感兴趣的文章
ideas about sharing software
查看>>
different aspects for software
查看>>
To do list
查看>>
Study of Source code
查看>>
如何使用BBC英语学习频道
查看>>
spring事务探索
查看>>
浅谈Spring声明式事务管理ThreadLocal和JDKProxy
查看>>
初识xsd
查看>>
java 设计模式-职责型模式
查看>>
构造型模式
查看>>
svn out of date 无法更新到最新版本
查看>>
java杂记
查看>>
RunTime.getRuntime().exec()
查看>>
Oracle 分组排序函数
查看>>
删除weblogic 域
查看>>
VMware Workstation 14中文破解版下载(附密钥)(笔记)
查看>>
日志框架学习
查看>>
日志框架学习2
查看>>
SVN-无法查看log,提示Want to go offline,时间显示1970问题,error主要是 url中 有一层的中文进行了2次encode
查看>>
NGINX
查看>>