zoukankan      html  css  js  c++  java
  • VIM useful commands must know them.

    yy              : cory the current line.
    p               : paste.
    0(number )      : move cursor to the front of the current line.
    $               : move cursor to the end of the current line.
    u               : undo
    ctrl + r        : redo
    N<command>[ESC] : repeat.
                       eg:
                       10p : past 10 times
                       10ohello<ESC>  : write 10 line hello
    set number      : display the line number.
    gg              : move cursor to the first line
    G               : move cursor to the last line
    15G             : move cursor to the 15th line
    *               : move cursor to the next same word
    #               : move cursor to the last same word
    %               : move cursor to the peer [{(
    w : move cursor to the front of the right word.
    b : move cursor to the front of the left word.
    e : move cursor to the last letter of the current word. y$ : cory the current line from the current cursor position. ye : cory the current word from the current cursor position. gU$ : change the current line to upper
    case gUe : change the current word to upper case gu$ : change the current line to lower case gue : change the current word to lower case
    Vim Usage:
    -- cursor mover
    n+       // move the cursor to the next n lines.
    n-       // move the cursor to the pervious n lines.
    nG       // move the cursor to line n.
    G        // move the cursor to the last line.
    --delete and undo
    x        // delete the current char
    nx       // delete n chars from the current char
    dd       // delete the current line.
    ndd      // delete n lines from the current line.
    u        // undo the previous command.
    U        // undo all the pervious commands.
    --set the line number
    :set nu     // set the line number display.
    :set nonu    //cancel the line number display.
    --copy and paste
    yy      // copy the current line.
    nyy     // copy from the current n line.
    yw      // copy from the current cursor to the end of the word.
    nyw     // copy n words from the current cursor.
    y^      // copy from current cursor to first letter of the current line.
    y$      // copy from current cursor to the end letter of the current line.
    p
    --replace
    :s/old/new         //use new replace the first old in current line.
    :s/old/new/g       //use new replace all the old in current line.
    :n,m s/old/new     //use new replace the first old from line n to line m.
    :n,m s/old/new/g   //use new replace all the old from line n to line m.
    :%s/old/new/g      //use new replace all the old in the document.
  • 相关阅读:
    CentOS7使用集群同步脚本对文件同步分发
    CentOS7安装jdk1.8
    CentOS7+CDH5.12.1集群搭建
    nginx通配符
    Nginx反向代理及配置
    一些好玩有用的书签
    linux操作小技巧锦集
    系统压测结果对比:tomcat/thinkphp/swoole/php-fpm/apache
    python修改linux日志(logtamper.py)
    【原创】给定随机数的取值范围(最小值、最大值),且要求多次取得的随机数最后的结果有一个固定的平均值
  • 原文地址:https://www.cnblogs.com/zhonghan/p/2881573.html
Copyright © 2011-2022 走看看