Basic operation of vim

vim normal mode, insert mode, command mode switch
                                  Vim opening, cursor movement, editing mode, normal mode, command mode switching Command

 cursor movement in the screen text can be done using either the keyboard up, down, left and right arrow keys, or the hjkl letter keys.

     h (left) j (down) k (up) l (right)

    To use the hjkl letter keys, you must ensure that vim is in normal mode. If it is in input mode, the letter keys cannot be used. Press ESC to return to normal mode.


 When you want to enter the vim editor, enter: vim file name <Enter>

How to enter insert mode?

  • a insert content after the cursor
  • A Insert content at the end of the line where the cursor is located
  • i inserts the content at the cursor position
  • I
  • s delete the character at the cursor, then enter insert mode
  • S
  • cw delete the characters from the cursor position to the end of the word, then enter insert mode
  • o Enter insert mode below the line where the cursor is located
  • O enter insert mode above the line where the cursor is located

 In normal mode to start inserting text at the cursor position.

     Enter i to enter the necessary text.

      Type a lowercase o to open a new line below the cursor and place the cursor at the beginning of the new line to enter insert mode.

     Type a capital O to open a new line above the cursor and place the cursor at the beginning of the new line to enter insert mode.

     Type a lowercase a to insert text after the cursor position. Type a capital A to insert text after the end of the line where the cursor is located.

     To exit edit mode and return to normal mode press <ESC>

 To exit the vim editor, please return to normal mode first, and enter: : (the second colon is keyboard input) to return to command mode, at this time, please enter the following command:

    <ESC> :q! <Enter> Here the colon It needs to be input. This is the exit method without saving the changes

     or enter the following command to save all the changes:

    <ESC> :wq <Enter> or: x, where the colon needs to be input

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325127227&siteId=291194637