05-003 [Linux] vi and vim editor

Basic introduction of vim and 1.vi

All Linux systems will be built vi text editor.

Vim has the ability to edit the program, can be seen as an enhanced version of Vi, you can take the initiative to identify the grammatical correctness of the font color for easy programming. Easy programming code-completion, and compilation errors jumps, etc. is particularly rich, it is widely used among programmers.

2.vi common and vim three modes

2.1 Normal mode

You can use shortcut keys to open a file directly into the vim normal mode.

2.2 Insert / edit mode

Can be input, pressing i / I / o / O / a / A / r / R to enter the edit mode, I usually use i / a.

2.3 command line mode

In this mode, the relevant instructions may be provided to complete the read, save, alternatively, leave Vim, operation display line numbers and the like.

Learn finishing in Linux

3. FIG three modes conversion

Here Insert Picture Description

4. Use Case shortcuts

  1. Copy of the current line yy, copy the current row five rows down 5yy, and paste p;
  2. Delete the current row dd, delete the current row five rows down 5DD;
  3. Find a word in the file command line [/ keywords, Enter Find, Find Next is the input n];
  4. Set file line number, line number [cancel the file command line set nu / set nonu];
  5. Edit / etc / profile file, use the shortcut to the last line of the document [G] and [gg] most the first line, note that these are carried out in a normal mode;
  6. In one input file "hello", and then the undo operation input u in the normal mode;
  7. Edit / etc / profile file and move the cursor to the line 20: ① display line numbers: set nu; ② the number of input 20; ③ input shift + g;

5.vim and vi-glance view of keyboard shortcuts

Here Insert Picture Description
Here Insert Picture Description
Learn finishing in Linux .

Published 53 original articles · won praise 0 · Views 367

Guess you like

Origin blog.csdn.net/weixin_40778497/article/details/104043959