VI Editor BASIC commands

Source: Internet
Author: User

Command mode (ESC)

K Move up one line
J Move down one line
H move one line to the left
L Move Right One line

6j Move Down 6 rows
5k Move up 5 rows

0 Place the cursor at the beginning of a row
$ put a cursor at the end of a line
W move a cursor to the next word
b move the cursor to the previous word
CTRL + B Roll back one screen
CTRL + F roll forward one screen
: x moves the cursor to the X row
: 3 Moves the cursor on the third row
: Set NU Displays line number

/what/What to look for (remember two times ESC after entering this command)
: Q Exit VI Editor
: W Save Content
: Wq Save and exit
: q! : w! : wq! There is no protection against direct execution.
ZZ Save and exit
: X Save and exit
: w filename Saves the file as Filenema
: e! Open File last successfully written version (no current action saved)

J merges the current row with the following line
YY Copy Current line contents
YW copy the current word content
P (lowercase p) Place the copied text behind the cursor
P (uppercase p) places the copied text in front of the cursor

\< matches the beginning of a word
\> matches the end of a word

: The s/old/new/substitution command modifies only one
: S/old/new/g Modify Current line (g:globally)
x,ys/old/new/replace x rows to Y lines with the first of each row
x,ys/old/new/g replace x line to Y line with all
: 1, $s/old/new/g replace all of the text
: 1, $s/old/new/gc the user must enter Yes or no to confirm each modification
: 1, $s/\*/hello/g replace * in text with Hello
: 1. $s/\<the/none/g to replace the beginning of the

VI Editor BASIC commands

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.