Home php教程 PHP开发 Memorize common Vim commands and get twice the result with half the effort in Linux programming

Memorize common Vim commands and get twice the result with half the effort in Linux programming

Nov 23, 2016 am 11:33 AM

People who want to program in Linux must use vim. Vim is the most commonly used editor in Linux today, so... If you memorize Vim's common commands, Linux programming will get twice the result with half the effort. The common commands of vim are listed below:


i → Insert mode, press ESC to return to Normal mode.
x → Delete a character where the current cursor is.
:wq → Save + exit (:w save, :q exit) (Chen Hao’s note: :w can be followed by the file name)
dd → delete the current line and save the deleted line to the clipboard
d (delete )
v (visual selection)
gU (change to uppercase)
gu (change to lowercase)
a → insert after the cursor
o → insert a new line after the current line
O → insert a new line before the current line
cw → Replace the characters from the cursor position to the end of a word

2dd → ​​Delete 2 lines
3p → Paste the text 3 times

NG → Go to the Nth line (Chen Hao's note: Note that the G in the command is capitalized, In addition, I usually use: N to the Nth line, such as: 137 to the 137th line)
gg → to the first line. (Chen Hao's note: equivalent to 1G, or :1)
G → Go to the last line.
Move by word:
w → to the beginning of the next word.
e → to the end of the next word.
> If you think words are written by default, use lowercase e and w. By default, a word consists of letters, numbers and underscores

Move the cursor on the current line: 0 ^ $ f F t T , ;
0 → to the beginning of the line
^ → to the first non-blank character of the line
$ → to the end of the line
g_ → to the last position of the line that is not a blank character.
fa → Go to the next character of a, you can also fs to the next character of s.
t, → to the first character before the comma. Commas can be changed to other characters.
3fa → Find the third occurrence of a in the current line.
F and T → are the same as f and t, but in opposite directions.

0 → Go to the beginning of the line first
y → Start copying from here
$ → Copy to the last character of this line
You can enter ye to copy from the current position to the last character of this word.

You can also enter y2/foo to copy the string between 2 "foo".

There are still many times where you don’t necessarily have to press y to copy. The following command will also be copied:

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1670
14
PHP Tutorial
1274
29
C# Tutorial
1256
24