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 working modes in vi

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

Share

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

Editor to share with you what are the working modes of vi, I hope you have something to gain after reading this article, let's discuss it together!

Vi has three working modes, namely: 1, command mode, which is the working mode entered after starting vi, and can be converted to text editing mode and last line mode; 2, text editing mode for character editing; 3, last line mode.

Vi has three working modes: command mode, text editing mode, and last line mode. The operation methods are different in different working modes.

1. Command mode:

Command mode is the working mode that is entered after starting vi, and can be converted to text editing mode and last line mode. In command mode, any characters entered from the keyboard are interpreted as editing commands and are not displayed on the screen. If the character entered is a valid vi command, vi will complete the corresponding action; otherwise, vi will ring a warning.

2. Text editing mode:

Text editing mode is used for character editing. Enter I (insert command), a (additional command) and other commands in command mode and enter text editing mode. At this time, any characters entered are displayed on the screen as file content by vi. Press ESC to return to command mode from text editing mode.

3. The last line mode:

In command mode, press the ":" key to enter the last line mode, and vi will display the ":" symbol year at the bottom of the screen as a prompt for the last line mode, waiting for the user to enter the relevant command. After the command is executed, vi automatically returns to command mode.

Extended data:

Restore files:

When vi edits a file, it generates a temporary file with. Begins and ends with .swp. If you exit the file normally, it will be deleted automatically. If you exit unexpectedly, such as a sudden power outage, the file will not be deleted. We can select the following command to handle it the next time we edit it:

O read-only open without changing the contents of the file

E continue to edit the file without restoring the saved contents of the .swp file

R will restore the contents of the file that have not been saved since the last edit

Q exits vi

D Delete .swp file

Or use the vi-r file name to restore unsaved content

After reading this article, I believe you have a certain understanding of "what are the working modes in vi". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

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