Linux: a text editor summary (vi, vim)

File Edit View command summary

vi Notepad

moving a cursor fast shortcut

    纵向移动: gg G ngg
    横向移动: 0/^  $

b edit mode to move the cursor into

    i I a A o O C cc

c Quick Edit text message

    dd ndd yy nyy p np

d special operating mode to edit text

    显示或取消显示行号信息
    :set nu 
    :set nonu
    撤销文本内容编辑操作
    u  undo 
    ctrl + r  redo
    快速搜索文本指定内容
    /搜索内容 -- n 进行选择
    PS:忽略大小写搜索信息
    1. 设置方法 :set ic         / 取消方法 :set noic
    2. 设置方法 :set ignorecase / 取消方法 set noignorecase
    3. 查找方法 /search-text\c
    快速删除内容到达行尾
    dG   将光标所在位置内容,到行尾信息全部删除
    

vim nodepad ++ (more powerful) has a different color to distinguish between information

1. Cancel Highlight

     /搜索一个文件中没有的信息

2. Quickly move or copy data

     :2,4move9      --- 将第几行到第几行的内容移动到指定行的后面
     :2,4copy9      --- 将第几行到第几行的内容复制到指定行的后面

3. The contents of the file information to be modified to replace

     %s#oldboy#oldgirl#g   --- 将文件中指定信息全部做替换
     % 全部做替换
     s substitute  替换
     g global      将整行符合要求的字符都做替换
     #要替换的信息#修改成什么信息#        
     
     替换修改文件部分内容
     :2,4s#oldgirl#oldboy#g    --- 将第二行到第四行内容进行替换
     :12,$s#oldgirl#oldboy#g   --- 将第十二行到结尾内容进行替换

4. batch modify file content

01. batch annotate --- bulk add information
     第一个步骤:进入批量编辑状态(视图模式)
     ctrl+v    --- 进入试图模式
     -- VISUAL BLOCK --      
     第二个步骤:批量选中要编辑的行
     方向键选择
     第三个步骤:进行编辑修改
     shift+i--进行单行编辑
     第四个步骤:实现批量修改
     按esc
     
02. Batch delete information
     第一个步骤:进入批量编辑状态(视图模式)
     ctrl+v    --- 进入试图模式
     -- VISUAL BLOCK -- 
     第二个步骤:批量选中要删除的列
     方向键选择  
     第三个步骤:删除信息
     按键盘字母d 或者 按键盘字母x   

Guess you like

Origin www.cnblogs.com/moox/p/12150652.html