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

What are the common commands in vim

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article introduces the relevant knowledge of "what are the common commands in vim". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Move, jump

H, j, k, l: correspond to left, bottom, top and right, respectively. Press the keyboard, from left to right, counterclockwise.

W: move to the beginning of the next word.

W: also move to the beginning of the next word. The difference between the two: root/usr bin, cursor at r, w to /, W to b.

B: opposite to w, it moves forward.

B: opposite to W, move forward. The difference between the two: same as above w and W.

E: move to the end of the next word.

E: also move to the end of the line of the next word. The difference between the two: same as above w and W.

Ge: opposite to e, move forward.

GE: opposite to E, move forward. The difference between the two: same as above w and W.

$: move to the end of the line.

^: move to the first non-white space character on the current line.

0 (number 0): move the beginning of the line.

F: single character search. Fx, search for the x character, ";" character x in the same direction as f. "," and ";" move to the previous character x in the opposite direction to f.

F: search to the left. ";": in the same direction as F, move next to the left. Opposite to F, move next to the right.

T: the function is similar to f, except that the t cursor stays over the first character of the search character.

T: search in the opposite direction.

Note: the above commands (except ^ and 0) support the "numeric-command" form. 2w .

%: match parentheses, curly braces, square brackets.

H: the screen shows the top of the content. Home .

M: the middle of the screen display. Middle .

L: the bottom of the screen display. Last .

Gg: jump to the first line.

G: jump to the last line.

``: the one above the table key, return to the position before the jump. Press again and return to the original position. Example: at 1100g, enter ``, go back to 1, and press back to 100.

: marks: the command is displayed as follows

`: the starting point before this jump ``: the last position of the cursor when the file was last edited [: the starting position of the last modification]: the end position of the last modification

Custom tag: M + [a-z], for example: define ma in 10 lines, jump to 100, enter "`a", jump to 10.

Ctrl+o (letter): jump forward. Example: go back to 20 in 1, 20 gg50 in 50, and press back to 1.

Ctrl+i: the effect is opposite to that above.

Number%: percentage jump.

Scroll the screen

Ctrl-u: the text scrolls down to half the screen. The cursor does not move with the text. The window equivalent to text moves up half the screen.

Ctrl-d: the window moves down half the screen, which is equivalent to the text scrolling up half the screen.

Ctrl-e: scroll up one line.

Ctrl-y: scroll down one line.

Ctrl-f: scroll forward one screen. Forward

Ctrl-b: scroll back one screen. Backward

Zt: places the current line at the top of the screen.

Zb: places the current line at the bottom of the screen.

Zz: places the current line in the center of the screen.

Search, modify

/ + word: search word,n to jump to the next, N reverse jump. If there are characters such as. [] ^% /? ~ $, add a backslash.

/ + word >: matches only words that end in word.

/ +

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

Internet Technology

Wechat

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

12
Report