Tag: Unit is identity shift move operating system image. com forced exit
Linux System Vi/vim Editor simple Introduction, installation/uninstallation, common command 1, Introduction
The VI (Visual Interface) Editor is the most basic text editor on Linux and Unix, working in character mode. Because no graphical interface is required, VI is a highly efficient text editor. and Vim (vi iMprove) is the enhanced version of VI, in the Linux/unix operating system This editor is powerful to unimaginable, understand here can be, and then want to know more detailed self Baidu.
2. Vim Editor installation and uninstallation 2.1 install Vim
sudo apt-get install vim
Tip: [y/n]? Reply "Y" to
Uninstallation of the 2.2Vim editor
sudo apt-get remove Vim-common (uninstall Vim editor related packages)
。。。
3. The working mode of Vim editor
Basically, Vi/vim is divided into three modes, namely command mode, input mode and bottom command mode (last line mode).
Mode Direct switch (this image from the rookie tutorial)
Figure 3.1 Mode switching
3.1 Command mode
Create a new file helloworld.c or simply use vim filename to open a file and save it
Open the file with the VIM filename command
HELLOWORLD.C blank file opens the file by default when the current file name appears in the lower left corner of the command mode
Command mode
Character-by-word movement
H: Left
L: Right
J: Down
K: Up
#h: Moving a # character
Move in a word unit
W: Move to the beginning of the next word
E: Jumps to the ending of the current or next word
B: Jump to the beginning of the current or previous word
#w: Indicates moving # words
In-line jump
0: The absolute beginning
^: first non-whitespace character at the beginning of a line
$: absolute end of line
Inline jump
#G: Jump To Line #
G: Last line
Input I, write a simple C language program (the bottom left corner of the insert insertion mark is the input mode, this time you can enter text)
3.2 Input modes (Insert mode)
Enter the following letters to convert to input mode
- I: Switch to input mode before the current cursor character
- I: Convert to input mode at the beginning of the line where the cursor is currently located
- A: After the current cursor character, switch to input mode
- A: At the end of the line where the cursor is located, convert to input mode
- O: Create a new row below the current cursor line and switch to input mode
- O: Create a new row above the current cursor line and switch to input mode
- S: Delete the character of the cursor
- R: Replace the character at the cursor
You can use the direction keys to move the cursor in input mode
3.3 Baseline Command mode (last line mode)
Command mode to enter a colon to the bottom line command mode
Baseline pattern Common commands
- W: Save
- Q: Exit
- Wq or x: Save exit, Wq and X are saved exit
- Q! : Forced exit
- W! : Force save, administrator has permission
4. More Commands to
If you would like to know more commands, etc. you can use Vimtutor for about 30 minutes to read the following Vim official tutorials
The first introduction is the cursor movement in command mode.
※※ to move the light target, press the H, J, K, L keys according to the stated points. ※※
^
K indicates that the key of the:h is on the left, and each time it is pressed it moves to the left.
The keys for < H L > L are on the right, and each time you press it, you move to the right.
J Key looks like an arrow pointing down in the tip direction.
V
Wait a minute
Simple introduction to Linux system Vi/vim Editor, installation/uninstallation, common commands