Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the parameters of vim

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

vim general mode:

(1) Press the x key to delete the content behind this line (delete backward)

(2) Press shift + x to delete the previous content of this line (delete forward)

(3) Press the number n, then press the x key to delete n characters backwards

(4) Press the number n, then press shift + x to delete n characters forward

(5) If you want to reverse the previous editing operation, you can press the u key. Up to 50 backsteps

(6) If you want to undo the rollback operation, you can press ctrl + r.

(7) If you want to delete a line, press the d key twice, and the deleted content is stored in the clipboard in memory. At this point, if you press the p key, you can paste the content just deleted in the next line of the current line. If you press shift + p you can paste a line above the current line.

(8) Press the number n, then dd, to delete n rows.

(9) Press the number n, then yy, and you can copy n lines.

(10) Press the number n, then press x, then delete (also cut). Of course, you can press p to paste at this time.

(11) Press the v key to enter the visual mode. At this time, press the (h,j,k,l) key to move the cursor and select the selected text (or text block). Then press the x key. At this time, the selected text (or text block) will be saved to the clipboard in memory.

Press the letter j to move the cursor down

(B) Press the letter k to move the cursor up

Press the letter h to move the cursor to the left

(D) Press L to move the cursor to the right

(E) Press Ctrl + B or PageUp to move the cursor up the screen

(F) Press ctrl + f or pagedown key to move the cursor down the whole screen

(G) Press shift + g to move the cursor to the end of the file

(H) Press the letter g twice to move the cursor to the first line of the document

Press shift + 4($) to move the cursor to the end of a line

(J) Press shift + 6(^) or letter 0 to move the cursor to the first letter of a line, but if there is a space before the first letter, ctrl+6(^), then move the cursor to the first letter of the non-space, press letter 0, then move the cursor to the first space.

vim editing mode

(1) Press the i key, the cursor is at the current position, and enter edit mode.

(2) Press the I key, at this time the cursor moves to the beginning of the current line, and enters the edit mode.

(3) Press the a key, at this time the cursor moves backward one position, and enters the editing mode.

(4) Press the A key, and the cursor moves to the end of the current line and enters edit mode.

(5) Press the o key, at this time the cursor moves to the beginning of the line next to the current line, and enters the editing mode.

(6) Press the O key, at this time the cursor moves to the beginning of the newly inserted line above the current line, and enters the editing mode.

vim command line mode

:wq write and exit:w write:q exit all three can cooperate! Use of enforcement

Up: arrow up, k

Down: arrow down, j

Left: arrow left, h

Right: arrow right, l

2j: Go down two rows, similar in other directions

Next page: ctrl+f, pagedown

Page up: Ctrl+B, page up

gg: Skip to the first line

Shift+G: Jump to the last line

Start of line: shift+6(no spaces), home, 0

End of line: shift+4, end

10 shift+g Go to line 10

(K) Number + shift + g The cursor jumps to the line where the number is located

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report