• VIM 初步


    按i前插入字符。a在光标后追加字符

    ctrl+d将光标下称半个窗体。按Ctrl+u将光标上移半个窗体

    在输入模式下:ctrl+h删除字符,ctrl+u删除行。ctrl+w删除字

    命令模式下。x删除字符。dw删除字,dd删除行

    u表示撤销上一个操作

    ctrl+r或输入命令:redo。表示重做

    命令dw和i能够用一条命令cw(chang world)来实现。

    命令cw能够使用VIM进入输入模式

    $ vim -r memo

    :w memo2

    可将文件另存

     

     

    dw: delete current word, but first thing for this command is the cursor has to be the first character of the word.
    d$: delete to the end of the line
    0: move to the end of the line.
    d3w: delete the 3 words after the cursor. d4w will delete 4 words
    U: To undo all the changes on a line
    p: put the line which deleted by command 'dd' under the cursor line
    r: Type rx to replace the character at the cursor with x
    ce: To change until the end of a word, type ce
    c$: Delete the context from cursor to the end of the line, and go the input mode
    ctrl+g : To show your location in the file and the file status.
    G: Go to the bottom of the file.
    gg: To move you to the start of the file.
    G: Type the number of the line you want to go and then G, this will go to the line you wann to go.

    /: search for the phrase from forward
    ?

    : search for the phrase from backward
    n: search the same phrase again, simple type n
    N: search the same phrase in the opposite direction, type N
    ctrl+o: To go back to where you came from. Repeat to go back further
    ctrl+i: To go forward
    %: to find a matching ),], or }. This is very useful in debugging a program with unmatched parentheses
    :s/old/new/ to substitute 'new' for 'old', only change the first occurrence
    :s/old/new/g to substitute 'new' for 'old', will change all the occurrences in the line
    :%s/old/new/g to change every occurrence in the whole file
    :%s/old/new/gc to find every occurrence in the whole file, with a prompt whether to substitute or not
    o: to open a line below the cursor and place you in insert mode.
    O: to open a line above the cursor and place you in insert mode.
    a: to insert text AFTER the cursor
    i: to insert text BEFORE the cursor
    A: to insert text at the end of line
    R: replace more than one character
    r: replace one character of cursor position

    copy and paste: 
    1. start visual mode with v and move the cursor to select the text you want to copy
    2. Type y to yank(copy) the highlighted text.
    3. Go to the position which you want to paste your text
    4. Type p to put(paste) the text

    set option:
    :set number(set nu): show up line number
    :set ic: set ignores case when searching or substitute
    :set hls is: set lisearch and incsearch option
    :set noic: disable ignoring case 
    if you want to ignore case for just one search command, user c in the phrase: /youStringc

    版权声明:本文博客原创文章。博客,未经同意,不得转载。

  • 相关阅读:
    改主机风扇转速
    PyTorch Live get started from Windows
    完全离线环境下安装Docker,Dockercompose,Airflow
    业余无线电爱好者,自制天线比较容易上手天线“莫克森天线”Moxon
    冠状动脉疾病患者的永久监测(GeneXus物联网应用)
    GeneXus开发示例瑞索纳控股有限公司
    超级App如何工作?
    2022年低代码关键点:GeneXus即将推出什么!
    Elementdialog创建新建页面
    element 表单校验与移除表单检验
  • 原文地址:https://www.cnblogs.com/bhlsheji/p/4628348.html
Copyright © 2020-2023  润新知