Linux commands to learn -vim

General operation of vim

Users just started vi / vim, then enter the command mode.
vim file open, o: read-only mode, i: input mode, esc exit the input mode

Description: vim contains three modes, respectively

  • Command mode: browse files, temporary change vim works, character batch processing (also configurable)
  • Insert mode: The contents of the file for editing
  • Exit Mode: Exit VIM operation

First, the command mode

1, the characters search

/ ## If there is a keyword in the content, it will jump to that keyword

n ## downwardly Content Match

N ## content match up

Operation: vim file ---> / Ubuntu ---> N (or n)

2, the cursor moves in command mode

The first line gg ## to move the cursor to the file

The last line of G ## to move the cursor to the file

: Digital cursor ## to the specified line

Second, insert mode

  • Moving the cursor in insert mode

Third, the exit mode

: Q ## exit, used when the file contents have not been changed

:! Q ## forced to quit without saving, do not want to use the time saved after changing the file

: Wq ## Exit Saves

!: Wq ## forced to quit saving, used when writing to a read-only file, note that the edited file must be read-only file the current user; the user or the current operation is the root

Reproduced in: https: //www.jianshu.com/p/f301d077aa05

Guess you like

Origin blog.csdn.net/weixin_34405557/article/details/91143957