Linux Vim Text Editor

Source: Internet
Author: User

  1. Vim Command mode

    Vim can be configured to work in Vim's command mode
    : Set nu line number added

    650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/9C/29/wKioL1lszNOjo3V-AAGGfA_ifkw114.png-wh_500x0-wm_ 3-wmp_4-s_649828243.png "title=" screenshot from 2017-07-17 22_22_43.png "alt=" Wkiol1lsznojo3v-aaggfa_ifkw114.png-wh _50 "/>
    : Set Nonu Cancel line number
    : Set Mouse=a Add mouse selection
    : Set Cursorline line display

    650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/9C/29/wKioL1lszOORs8f1AAHUIqeH6dk694.png-wh_500x0-wm_ 3-wmp_4-s_2108983301.png "title=" screenshot from 2017-07-17 22_23_22.png "alt=" Wkiol1lszoors8f1aahuiqeh6dk694.png-wh_50 "/>

    The above settings are temporary,
    Permanent setting mode
    VIM/ETC/VIMRC This file is a vim configuration file, at the end of this file add the above parameters, add to the number of files do not need:

    650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/9C/29/wKioL1lszPKwJMf5AADDGlYCUFk424.png-wh_500x0-wm_ 3-wmp_4-s_3283779710.png "title=" screenshot from 2017-07-17 22_25_26.png "alt=" Wkiol1lszpkwjmf5aaddglycufk424.png-wh_50 "/>


    2.vim Command mode keyword search
    /keywords
    N Match down
    N Up match

    650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/9C/29/wKiom1lszQLRD2KGAAG3jfxrVas696.png-wh_500x0-wm_ 3-wmp_4-s_4046956236.png "title=" screenshot from 2017-07-17 22_25_59.png "alt=" Wkiom1lszqlrd2kgaag3jfxrvas696.png-wh_50 "/>

    Character Management in 3.vim command mode
    1. Copying of characters
    YL Copy a letter
    Y3L Copy 3 Letters
    YW copy a word
    y3w Copy 3 words
    YY Copy a row
    Y3Y Copy 3 Rows
    P paste "p" after copy completion

    2. Deletion of characters
    DL Deletes a letter
    D3L Delete 3 Letters
    DW Delete a Word
    d3w Delete 3 words
    DD Delete a row
    D3D Delete 3 rows

    3. Cutting of characters
    CL Cut a letter
    C3L Cut 3 Letters
    CW Cut a word
    C3W Cut 3 words
    CC Cut one line
    C3C cut 3 Rows
    NOTE: pressing ESC---> P after clipping will go into insert mode and be sure to exit Insert mode when performing the paste action

    4.vim Visualization Mode

    Press "CTRL + V" in command mode to enter the visual mode
    In visual mode, you can select characters in the area

    Bulk add characters in visual mode
    *>> Ctrl + V Select the column to which you want to add characters
    *>> Press "I" into insert mode, write the characters to be added
    *>> Press ESC

    650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/9C/29/wKioL1lszRzxI1eLAAGFApVeufs966.png-wh_500x0-wm_ 3-wmp_4-s_122552148.png "title=" screenshot from 2017-07-17 22_27_37.png "alt=" Wkiol1lszrzxi1elaagfapveufs966.png-wh _50 "/>

    5. Bulk modification of characters

    :%s/the original character/replacement character replaces only the first existing character that appears in each line

    650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/9C/29/wKiom1lszsmx5pslAAG_GJ8lQyw924.png-wh_500x0-wm_ 3-wmp_4-s_2570235494.png "title=" screenshot from 2017-07-17 22_49_50.png "alt=" Wkiom1lszsmx5pslaag_ Gj8lqyw924.png-wh_50 "/>
    :%s/original character/replace character/g replace all
    :%s/^\ *//g The blanks at the beginning of the full text, "^\ *" indicates the space at the beginning of the line

    6.vim Split-screen function
    Ctrl+w s up and down sub-screen
    Ctrl+w v left and right split screen

    650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/9C/29/wKiom1lszXaAsGqKAAAbNQa1DzY653.png-wh_500x0-wm_ 3-wmp_4-s_2078722056.png "title=" screenshot from 2017-07-17 22_35_23.png "alt=" Wkiom1lszxaasgqkaaabnqa1dzy653.png-wh_50 "/>
    Ctrl+w c Close the screen where the cursor is located
    Ctrl+w up or down cursor to the specified screen
    : SP File2 simultaneously edits the current file and File2

    650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/9C/29/wKioL1lszYWA8omfAABEEo_QlX0552.png-wh_500x0-wm_ 3-wmp_4-s_2964026904.png "title=" screenshot from 2017-07-17 22_36_14.png "alt=" Wkiol1lszywa8omfaabeeo_ Qlx0552.png-wh_50 "/>



7.vim cursor Movement
in command mode
: The number moves to the specified line
Last line of G file
GG File First line

In insert mode
I insert the cursor where it is located
I the line at the beginning of the cursor
A next position of the character where the cursor is located
A the end of the line where the cursor is
o The next line in the row where the cursor
O a row on the line where the cursor is
s remove the character insertion of the cursor
S Delete the line where the cursor is inserted

Exit mode of 8.vim
: Q When you open a file with vim, but you do not have any action on the character, you can exit directly
: q! When using VIM to open a file and manipulate the characters, discard all operations to exit
: Wq Save Exit
: wq! Force-Save exit, take effect for Superuser and file owner

9.vim Manual
Vimtutor Vim's Handbook
: Q Exit Vimtutor


Vim is a powerful editing software, today can only be explained to you these commonly used, I hope everyone in the future work slowly discover new features, skilled use of vim editing software. I also hope that with the common progress, as soon as the Linux great God!


Linux Vim Text Editor

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.