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 commands in vim

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to use commands in vim". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Let the editor take you to learn how to use the commands in vim.

: help command name

Move the cursor to the beginning of the next word, use the command "w", move the cursor to the end of the next word, and use the command "e"

Move the cursor to the beginning of the previous word, use the command "b", move the cursor to the end of the previous word, and use the command "ge"

H, j, k, l represent moving to the left, down, up and right, respectively.

K

L h

J

CTRL-B turns the page up

CTRL-F turns the page down

The first line of the gg file

The last line of the shift-g file

Move to the specified character fplink F

Moving to the beginning of the line is the number 0, and moving to the end of the line is $

Copy and paste

Dw

Delete a word (word)

X

Delete the current character

X deletes the previous character

D delete to the end of the line

Yy

Copy one line, which can be preceded by a number to identify multiple lines to be copied, such as 6yy, indicating that 6 lines are copied from the current line

Yw

Copy a word

Y $

Copy to the end of the line

P

Paste the contents of the pasteboard below the current line

P

Paste the contents of the pasteboard to the top of the current line

] p

With indented paste, vim automatically adjusts the indentation of the code

Find and replace

/ pattern

Search backward for the string pattern

? pattern

Search forward for the string pattern

N

The next match (if it is / search, then the next one down,? Search is the next up)

N

Previous match (ibid.)

:% s/old/new/g

Search the entire file and replace all old with new

:% s/old/new/gc

Search the entire file and replace all old with new. Each time you are asked to confirm whether to replace it.

Move H on the screen move the cursor to the top line on the current screen

M

Move the cursor to the middle line on the current screen

L

Move the cursor to the bottom line on the current screen

Act on the tag

>

Block right shift

<

Block left shift

Tagged text

Ctrl+v

Enter visual mode, column mode, similar to UE column mode

Aw

Select a word

At this point, I believe you have a deeper understanding of "how to use commands in vim". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Servers

Wechat

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

12
Report