linux operating in vi and vim

A. Brief

vi and vim similar to the windows text editor

All Linux systems will be built vi text editor

vim can be seen as an enhanced version of vi, with a program editing capabilities , support for syntax highlighting , code completion , compilation and error jumps and other functions, and thus is widely used

If Linux does not vim this command, you can manually download:

yum install vim

Since similar operations are later Examples took vim

vim 文件名 If you have not created and open, if it is open

vi 文件名

II. Introduces three models

  • Normal mode: we can use shortcut keys for text operations, such as: copy and paste --yy: p
  • Insert Mode: Press i, o, a, r, I, O, A, R a to any key, the insert mode.
  • Command line mode: In this mode, the programmer can enter the relevant instruction, such as to complete: save, leaving the display line numbers and other functions (specific instructions later say)

III. Switch between three modes

IV. The normal mode instructions used

1.拷贝当前行,并粘贴                 拷贝 yy    粘贴:p
        
2.拷贝当前行向下5行,并粘贴 拷贝5行    5yy
    
3.删除当前行 删除                   dd
    
4.删除当前行向下5行 删除5行          5dd
    
5.光标移至最后一行                  shift+g 或者G

6.光标移至首行                     gg

7.移动到第7行                      7gg

8.撤销                            u

9.撤回                            ctrl+r

V. command mode commonly used commands

1.查找某个关键字    /关键字
2.取消高亮        :nohl
3.显示行号        :set nu
4.取消行号        :set nonu

Guess you like

Origin www.cnblogs.com/pythonywy/p/11759294.html