Linux VI Edit

Source: Internet
Author: User

Vim is a text editor developed by VI

Three modes:

Three modes of command, input, last line

Command-Input mode:

A current cursor after input

A Line End Input

I cursor position input

I input at the beginning

o Cursor Next line input

O one line input on the cursor

Input, Command mode:

Esc

Command-and-last-line mode:

: Set NU Displays line number

: Set Nonu suppress line numbers

(Last-line mode: Set NU indicates line number)

[Email protected] kkk]#VITest.SH      1#!/bin/Bash2 Ping-C3 192.168.10.128      3 if[$?-eq0 ]      4    Then      5   Echo "The host is up!"      6 fi      7~~~: Set Nu

Last line, Command mode:

Esc

G Jump to last line

4G Jump To line fourth

GG jumps to the first line

YY Copy a row

3YY copy cursor below 3 lines

P Paste (cursor next line position)

DD Delete

3DD Delete the following 3 lines

d$ Delete to end of line

d^ Delete to the beginning of the line

DW Delete a Word

U gradually undo until text initial state

U Cancel Bank operation

ZZ Save and exit

/Find (Down)

? Find (UP)

Last-line mode operation:

W

Q

W/home/2.txt Save As 2.txt

! Date does not interrupt VI temporarily executes a command

E/home/3.txt Open another file

R/home/4.txt

Replace:

: Sub/root/root//First substitution per line

: sub/root/root/g//Full line replacement

:% s/root/root/g//Full text replacement

:% s/root/root/c//Full text replacement, prompt execution

Replace with ROOT (y/n/a/q/l/^e/^y)?

Vimtutor A detailed explanation of VI

Linux VI Edit

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.