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 Vim operations in VS Code

2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces "what are the Vim operations in VS Code". In daily operation, I believe many people have doubts about what problems Vim operations in VS Code have. Xiaobian consulted various materials and sorted out simple and easy operation methods. I hope to help you answer the doubts about "what are the Vim operations in VS Code"! Next, please follow the small series to learn together!

directory

Vim Plugin Installation

Vim Foundation

Vim combinational logic commonly used in VS Code

Vim Plugin Installation

Download Vim Plugin

As shown above, download the Vim plug-in. It should be noted here that it is strongly recommended not to use the combination shortcut Ctrl that comes with Vim, because it will overwrite the shortcut keys of VS Code itself and the shortcut keys of other plugins.

Uncheck useCtrlKeys setting

As shown above, search for useCtrlKeys configuration in Settings and uncheck it.

vim scroll

It is worth noting that we can still scroll up and down pages using Ctrl + u and Ctrl + d, and the number of scrolling rows defaults to half a page.

Vim Foundation

Here is to introduce the foundation of Vim foundation, but still no Vim foundation beginners can also go to B station search Vim-related tutorials and consolidate it (I may also record videos later).

vim base

As shown above:

Vim defaults to normal mode, where tapping letters is a tapping command, not editing text; enter i to enter insert mode, where tapping letters is the input letter

In nsert mode, the escape key returns to normal mode.

In normal mode, hjkl is left, bottom, top and right respectively.

A I O operation in vim

As above:

In normal mode, Shift + a(later A) moves to the end of the line and changes to insert mode;I is the front of the line

In normal mode, o is inserted one line below, and jump

W b operation in vim

As above:

In normal mode, w is one word forward and b is one word backward.

Copy paste in vim

As above:

In normal mode, d is to enable clipping mode, so dw is to clip a word;dd is to clip a line

In normal mode, y is copy and p is paste.

vim in s x

As above:

In normal mode, s is to delete the current cursor and switch to insert mode, x is to delete and not switch

vim in g

As above:

In normal mode, 15gg is jump to line 15

Visual in vim

As above:

In normal mode, select Visual mode.

Vim combinational logic commonly used in VS Code

Vim enthusiasts often say that Vim is logic, not rote shortcuts (I am not a Vim enthusiast, this sentence is not me, but some friends in the Linux community).

My understanding of Vim's "logic" is roughly as follows:

Case is the opposite logic.

Some Ctrl and Scroll in VS Code

(meaning in brackets)

An explanation of the expansion follows.

Case is the opposite logic.

int foo_xyz = 1;

We know that when the cursor is at_, to delete_xyz, we first have to find the nearest z position and then delete everything in this interval. In vim, dfz is input to express, fz means find z.

f and F in vim

So, what's looking forward to? The answer is a capital F, as shown in the figure above.

o and O in vim

As above, o makes it easy to insert a line downward, while O inserts a line upward.

Some Ctrl and Scroll in VS Code

[] in vim

As above, Shift + [] is used to skip lines in units of "code blocks."

Ctrl + []

As above, Ctrl + [] enables indent adjustment. This is combined with visual mode.

Scroll in vim

[The first line of the document is skipped, and] is the end of the line.

H L M z in vim

As above, H is to the top of the screen, L is to the bottom of the screen, M is to the center of the screen, zz is to place the cursor in the center of the screen without moving the cursor (scroll screen), zt is to place the cursor in the top, and zb is to the bottom.

i(meaning in parentheses)

print(f"what {s}? ")

As above, when we want to empty the parenthesis of the print() function, we "logically" tell vim to do so. Move the cursor inside the brackets and enter ci(or ci), where i(is "inside the brackets."

At this point, the study of "What are the Vim operations in VS Code" is over, hoping to solve everyone's doubts. Theory and practice can better match to help you learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

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

Development