Linux Text Editor

Source: Internet
Author: User
Tags line editor linux text editor
Article Title: linux text editor. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Linux Text Editor

Objectives:

Knowledge about the editor in linux

Understanding the mode switching of the vi Editor

Measure the test taker's knowledge about the operation commands of the vi editor.

Linux text editor Overview

Line Editor and Full Screen Editor

Character Interface Editor and graphic interface editor

Vi Text Editor

Vi Mode:

Command mode:

Input mode:

Last line mode:

Basic use of the Vi Editor

1. Start and exit the vi Editor

2. Exit the vi editing environment.

3. Enter the editing environment and open the file

File Operations

1. Open a new file

: E filename

: E! Filename // The current file does not need to be saved

2. Read the file content to the current file

: R filename

3. Save the file

: W

4. Exit the vi editor.

: Q

: Wq

: Q!

Move cursor

1. move the cursor

H left, l right, k up, j down

2. Move pages

^ + F: Flip the whole page forward, ^ + B flip the whole page backward, ^ + u flip the half page forward, ^ + d flip the half page backward

3. fast intra-row jump

^ Beginning of Line

$ End of line

The first letter of the last word W

First letter of the previous word B

E. the last letter of the last word.

4. Fast jump between file experts

: Set nu

: Set nonu

Edit operation

1. Enter the input mode

: I a o O o cw c $ c ^

2. input mode operations

: Home end pageup pagedown backspace delete

3. Delete

: X dd dw de d $ d ^ J

4. Cancel the operation

: U U ^ + R

5. copy operation

: Yy yw y $ y ^

6. Paste

P

7. search and replace: The command is completed at the end of vi.

Top-down search operations

/Lowercase n and N of word

Bottom-up search

? Lowercase n and N of word

Normal Replacement Operation

: S/old/new

Only match and replace the current line, and replace the first matched character in the current line with the command

Replace all operations in the row

: S/old/new/g

Replace all matched strings in the current row

Perform the replacement operation in the row Region

: #, # S/old/new/g

Replacement in the entire file

: % S/old/new/g

Commands for replacement in the entire document

Use the replacement confirmation Function

: S/old/new/c

: S/old/new/gc

: #, # S/old/new/gc

: % S/old/new/gc

Online Help of vi Editor

Multi-file operations in the editor

1. Multi-file vi startup

Example:

$ Vi passwd fstab inittab

The vi editor displays the first file in the vi command parameters on the current editing screen. Other files are run in the background-not displayed! The vi editor can only edit files on the current screen at the same time. to edit the files, switch the files!

2. Multi-file Switching

Show multi-File Information

: Args

Switch multiple files before and after

: Next

: Prev

Connect "! "You can discard the changes to the current file while switching files before and after.

Locate the first and last files

: First

: Last

Fast File Switching

Ctrl + ^

Edit text in graphic interface: gedit

Related Article

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.