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 of the vi editor

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

Share

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

This article mainly introduces what the common commands of the vi editor are. It is very detailed and has a certain reference value. Friends who are interested must read it!

The common commands of the vi editor are: 1, I, switch to input mode; 2, x, delete the characters where the cursor is located; 3, Q, exit editing; 4, w, save the file; 5, a, insert content at the cursor location; 6, o, insert a new line after the line of the cursor.

The use of vi/vim

Vi is a full-screen editor working in the character terminal environment, so the editing interface is relatively simple, and does not provide users with mouse operation and menu system, but through keystroke commands to achieve the corresponding editing and operation functions. There are three different working modes that can be used in the vi editing interface. They are command mode (Command mode), input mode (Insert mode) and last line mode (Last line mode). Of course, there are different operations that can be done on files in different modes.

(video tutorial recommendation: linux video tutorial)

Command mode:

As soon as the user starts vi/vim, he enters command mode.

In this state, the keystroke action is recognized by Vim as a command rather than an input character. For example, if we press I at this time, we will not enter a character, I will be treated as a command.

Here are a few commonly used commands:

I switch to input mode to enter characters.

X deletes the character at the current cursor.

Switch to the bottom line command mode to enter the command on the bottom line

To edit the text: start Vim, enter command mode, press I, and switch to input mode.

Command mode has only some of the most basic commands, so you still have to rely on the bottom line command mode to enter more commands.

Input mode:

Press I in command mode to enter input mode.

In input mode, you can use the following keys:

Character keystrokes and Shift combinations, input characters

ENTER, enter key, line break

BACK SPACE, Backspace key, delete the character before the cursor

DEL, delete key, delete one character after the cursor

Arrow keys to move the cursor in the text

HOME/END, move the cursor to the beginning / end of the line

Page Up/Page Down, turn the page up / down

Insert, switch the cursor to input / replace mode, and the cursor will become vertical / underlined

ESC, exit input mode, switch to command mode

Last line mode:

Press: (English colon) in command mode to enter the last line mode.

The last line mode can enter single or multiple character commands, and there are many commands available.

In the bottom line command mode, the basic commands are (the colon has been omitted):

Q exit program

W Save the file

Press the ESC key to exit the last line mode at any time.

The above are all the common commands of the vi editor. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to 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