Before giving you a detailed introduction to the Linux editor Vi, first let everyone know about the editor Vi, and then give a comprehensive introduction to the Linux editor Vi, hoping to be useful to everyone. This chapter describes the most common text Linux editor Vi on Linux. The text Linux editor Vi is the most commonly used tool in all computer systems. When using a computer, users often need to create their own files. Whether it is a common text file, a data file, or a source program file, these tasks cannot be separated from the editor.
On-screen text Linux editor Vi
The Linux system provides a complete series of Linux editor Vi families, such as Ed, Ex, Vi, and Emacs. They can be divided into two categories by function: Row editor Ed and Ex) full Screen Editor Vi, Emacs ). Line Linux editor Vi can only operate on one line at a time, which is inconvenient to use. The full-screen Linux editor Vi can edit the entire screen, and the user-edited files are displayed on the screen directly. The modification results can be immediately displayed, overcome the unintuitive operations of row editing, which makes it easy for users to learn and use and has powerful functions.
Vi is the first full-screen interactive editing program in Linux. It has been favored by many users since its birth. It is still the main text editing tool used by people for decades, it is obvious that its vitality is strong, and its powerful vitality is brought about by its powerful functions.
In this chapter, we will gradually introduce how to use Vi to create, edit, display, and process files. Note: The uppercase letters in the text are [shift] keys + combinations of corresponding lowercase letters)
Vi Introduction
Vi is short for "Visual interface", and its position on Linux is as if the Edit Program is on DOS. It can perform output, delete, search, replace, block operations, and many other text operations, and users can customize it according to their own needs, which is not available in other editing programs.
Vi is not a typographical program. Unlike Word or WPS, it can orchestrate fonts, formats, paragraphs, and other attributes. It is just a text editing program.
Vi has no menu, only commands, and many commands. Vi has three basic working modes: command line mode, text input mode, and last line mode.
Command Line Mode
At any time, no matter what mode the user is in, just press the key to bring Vi to the command line mode; we enter the command to start Vi at the shell environment prompt $, when you enter the Linux editor Vi, It is also in this mode.
In this mode, you can enter various valid Vi commands to manage your own documents. At this time, any character entered on the keyboard is interpreted as an editing command. If the entered character is a valid Vi command, Vi completes the corresponding action after receiving the USER command. Note that the entered command is not displayed on the screen. If the entered character is not a valid command of Vi, Vi will ring an alarm.
Text input mode
In command mode, Enter command I, attach command a, open command o, modify command c, replace command r, or replace command s to enter the text input mode. In this mode, any character entered by the user is saved as the file content by Vi and displayed on the screen. During text input, if you want to return to command mode, press the key.
Last Row Mode
The last row mode is also called the ex escape mode. The Vi and Ex editors of the Linux editor have the same functions. The main difference between them is the user interface. In Vi, a command is usually a single key, such as I, a, o, etc. In Ex, the command is the text line ending with the Enter key. Vi has a dedicated "escape" command to access many line-oriented Ex commands. In command mode, you can press the ":" key to enter the last line mode. At this time, Vi will display a ": as the last line prompt, waiting for the user to enter the command. Most file management commands are executed in this mode, for example, writing the content of the editing buffer to a file is moderate ). After the last-line command is executed, Vi automatically returns to the command mode. Example: 1, $ s/A/a/g
Replace uppercase A with lowercase a from the first line to the end of the file. If you have changed your mind when entering the command in the last line mode, press the button or use the return key to delete all input commands, and then press the return key, the Vi can be returned to the command mode. For Linux editor Vi, if you want to switch from command mode to edit mode, you can type command a or I. If you want to return from text mode, Press Esc. In command mode, enter ":" to switch to the last line mode, and then enter the command.
- Fully Understand Linux Process Technology
- Introduction to the password command in Linux
- Learn about Linux regulatory commands
- A thorough understanding of Linux system faults and Solutions
- Linux systems can also achieve multi-touch