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

Exit the vi editor in linux and press the solution that esc does not respond

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

Share

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

This article is to share with you about the exit from the vi editor in linux, press the solution that esc does not respond, the editor feels very practical, so share it with you to learn, I hope you can get something after reading this article, not to say much, follow the editor to have a look.

Linux quit the vi editor, press esc no response to the solution: 1, press the Q keyboard in the normal mode; 2, select [a murz] or [0-9] as a buffer name, ready to start recording macros; 3, in non-insert mode, enter Q to stop macro recording; 4, use @ and the definition of the buffer name.

Exit the vi editor in linux and press the solution that esc does not respond:

Introduction to vim recording function

When using vim, I inadvertently touched the Q key, and the logo "recording" appeared in the lower left corner. I felt curious, so I checked it on the Internet, and then this is a powerful function of vim. He can record a Macro, and after starting recording, he will record all your keyboard input, including input in insert mode, various commands used in normal mode, etc.

Specific use:

Step 1: press the Q keyboard in normal mode (non-insert mode, non-visual mode)

Step 2: select any one of amurz or 0-9 as the buffer name, ready to start recording macros

Step 3: normal operation, all operations this time will be recorded in the buffer defined in the previous step

Step 4: enter Q to stop the recording of the macro in non-insert mode

Step 5: use the name of the buffer defined in @ + step 2.

For example, you want to put the following words

Line1line-2line3-1l4

Change to the following text

System.out.println (line1); System.out.println (line1); System.out.println (line-2); System.out.println (line3-1); System.out.println (L4)

Observe that they are regular, adding "System.out.println (", end ") at the beginning of each line of text;" becomes the following message.

Here's a brief description of how to use recording to do this.

First, move the cursor over line1, enter qt, ready to start recording, the name of the buffer is t, the recording action is: shift + ^ back to the beginning of the line, press I key to enter insert mode, enter "System.out.println (", press ESC key to return to normal mode, shift + $back to the end of the line, press I key to enter insert mode, type ");" press esc key to return to normal mode, press Q to stop recording. Then move the cursor anywhere on the following line and type @ + t.

Recording can also be used in conjunction with queries, such as macros that want to comment lines in a file that contain specific strings. Enter / search string + enter, shift + ^, I, #, esc, shift + $in normal mode.

The way to make a custom macro execute automatically multiple times is to enter a number first, and then enter the name of the @ + buffer. For example, 100 tons, it is executed 100 times.

The above is the solution to exit the vi editor in linux and press esc. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

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