Linux command----VI

Source: Internet
Author: User

The VI command is the most versatile full-screen plain text editor in Unix operating systems and UNIX-like operating systems. The VI editor in Linux is called Vim, which is the enhanced version of VI (VI improved), fully compatible with the VI editor, and implements a number of enhancements. VI Editor support editing mode and command mode, editing mode can complete the editing of the text, command mode can complete the operation of the command, the correct use of the VI editor must master two modes of switching. By default, the VI editor is opened and automatically enters command mode. Switch from edit mode to command mode use "ESC" key to switch from command mode to edit mode using "a", "a", "O", "O", "I", "I" Keys. The VI Editor provides a rich set of built-in commands, some built-in commands to use the keyboard key combinations, and some built-in commands that require a colon ":" to start typing. Common built-in commands are:

Ctrl+u: Half-screen to the first file;
Ctrl+d: Half-screen to the end of the file;
Ctrl+f: Flip a screen to the end of the file;
Ctrl+b: Turn one screen to the top of the file;
ESC: Switch from edit mode to command mode;
ZZ: Save the changes made in the current file in command mode and exit VI;
: Line number: The cursor jumps to the beginning of the specified line;
: $: The cursor jumps to the beginning of the last line;
X or x: Deletes a character, x deletes the cursor after it, and X deletes the cursor before it;
D: Removes all characters from the current cursor to the end of the line at which the cursor is located;
DD: Deletes the line contents of the cursor row;
NDD: Deletes the current line and its subsequent n-1 rows;
Nyy: Saves the contents of the current row and its next n rows to the register? In, where? is a letter, n is a number;
P: Paste the text action to paste the contents of the buffer below the current cursor position;
P: Paste the text action to paste the contents of the buffer above the current cursor position;
/String: Text lookup operation to find the contents of the specified string from the current cursor position to the end of the file, and the found string is highlighted;
? Name: Text lookup operation to find the contents of the specified string from the current cursor position to the head of the file, and the searched string will be highlighted;
A,BS/F/T: Replaces the text operation to replace the F string with a T string between line A and line B. where "s/" means a replacement operation;
A: Add text after the current character;
A: Add text at the end of the line;
I: Inserting text in the current word match either;
I: Inserting text at the beginning of the line;
O: Insert a blank line after the current line;
O: Insert a blank line before the current line;
: Wq: In the command mode, the execution of the disk exit operation;
: w: in command mode, perform disk operation;
: w! : In command mode, execute the forced disk operation;
: Q: In command mode, perform exit VI operation;
: q! : Executes the forced Exit VI operation in command mode;
: E file name: In command mode, open and edit the file with the specified name;
: N: In command mode, if you open more than one file at the same time, continue editing the next file;
: F: In command mode, displays the current file name, the line number of the line where the cursor is located, and the display scale;
: Set number: Used in command mode to display line numbers at the leftmost end;
: Set nonumber: In command mode, the line number is not displayed on the leftmost side;

Linux command----VI

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.