Sunflower collection in linux vi Editor

Source: Internet
Author: User

After studying the linux vi editor for a long time, I would like to share with you that you have certainly gained a lot after reading this article. I hope this article will teach you more things.
The linux vi editor is a standard editor for all Unix and Linux systems. It is not inferior to any of the latest text editors. Here we just briefly introduce its usage and a few instructions. The Linux vi editor is identical for any version of Unix and linux systems, so you can learn more about it in any other section about vi. Vi is also the most basic text editor in Linux. After learning it, you will be able to enjoy the free access in the Linux World.

1. Basic concepts of vi
Basically, vi can be divided into three states: command mode, Insert mode, and last line mode. The functions of each mode are as follows:
1) command Line mode)
Controls the movement of the screen cursor, the deletion of characters, words, or rows, the movement of copying a segment and entering the Insert mode, or to the last line mode.
2) Insert mode)
You can enter text only in Insert mode. Press ESC to return to command line mode.
3) Baseline mode: last line mode)
Save the file or exit vi. You can also set the editing environment, such as searching strings and listing row numbers ...... .
However, we generally simplify vi into two modes in use, that is, the last line mode in the baseline mode) is also included in the command line mode ).

2. Basic operations of vi
A) Go to vi
After the system prompts you to enter the vi and file name, you will be taken to the vi full screen editing screen:
$ Vi myfile
Note that after you enter vi, you are in command line mode). You must switch to Insert mode to Enter text. People who use vi for the first time will want to move the cursor first with the upper and lower right keys. As a result, the computer keeps beeping and getting angry with themselves. So after entering vi, do not tamper with the mouse, switch to "Insert mode!
B) switch to Insert mode. edit the file.
Click "I" under "command mode" to enter "Insert mode". Then you can start to enter the text.
C) Insert switchover
You are currently in "Insert mode". You can only enter text all the time. If you find that you have entered an error! To move the word back with the light mark key, you need to press ESC to switch to command mode in command line mode before deleting the text.
D) Exit vi and save the file
Under "command mode", click ":" colon to enter "Last line mode". For example:
: W filename input "w filename" to save the article with the specified file name filename)
: Wq (enter "wq" to save the disk and exit vi)
: Q! (Enter q !, Force exit vi without saving the disk)

3. command Line mode) function key
1). insert mode
Press "I" to switch to the insert mode "insert mode". Press "I" to enter the insert mode. The input file starts from the current position of the cursor;
After you press "a" to enter the insert mode, the text is entered starting from the next position where the cursor is currently located;
After you press "o" to enter the insert mode, a new row is inserted and text is entered from the beginning of the line.
2) switch from insert mode to Command Line Mode
Press ESC.
3) move the cursor
Vi can be moved up, down, left, and right directly with the cursor on the keyboard, but the regular vi uses lowercase letters "h", "j", "k", and "l 」, the cursor is controlled to move one cell to the left, down, up, and right respectively.
Press ctrl + B to move the screen to the back.
Press ctrl + f to move the screen to the front.
Press ctrl + u to move the screen to the back half of the page.
Press ctrl + d to move the screen half to the front.
Press the number "0": to move to the beginning of the article.
Press G to move to the end of the article.
Press "$" to move to the end of the row where the cursor is located ".
Press ^ to move the cursor to the beginning of the row"
Press w to jump to the beginning of the next word
Press "e": move the cursor to the end of the next word
Press "B": the cursor returns to the beginning of the previous word
Press # l to move the cursor to the # position of the row, such as 5l and 56l.
The preceding section describes the usage of the linux vi editor.

  1. Linux vendors released the latest operating system Ubuntu 9.10
  2. Linux Makefile
  3. Linux script compilation Basics
  4. Linux makefile
  5. Discuss the linux Emacs User Manual

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.