Common basic commands for Linux VI vim

Source: Internet
Author: User

Vim Install yum install-y vim

Vim View basic information vim--version

Vim Open and new file vim [filename]

Vim operation after entering the file

Note: There are several modes of vim first

1, shortcut key mode: Vim can only move the cursor up or down after opening the file, cannot write.

2, edit mode: Shortcut mode point keyboard i o A can enter the editing mode. Press ESC, from edit mode to shortcut key mode. The concept does not explain.

3, command-line mode: Press SHIFT + in the shortcut mode: called command-line mode (the main difference between the shortcut mode is the command can be displayed at the command line)

The basic command to explain the main in 1, 3 mode

Basic commands in shortcut key mode:

Dd Delete the cursor where you are moving forward
U Go back to previous steps
Ctrl + R Back much, before further
Yy Copy the cursor where you are moving forward
P Paste
N +DD where n is a number, delete the n rows below the current line where the cursor is located
n + yy where n is the number, and the next n rows at the beginning of the current line of the cursor are copied
Gg Quick back to top of file
Shift+gg Quickly back to the end of the file
SHIFT + $ Fast reach end of line
SHIFT + 6 Quickly reach the beginning of the line

Command-line mode base command:

: Set Nu Show line Numbers
: Set Nonu Do not display line numbers
/"Characters to look for" Full text find characters from top down
? "Characters to look for" Full text find characters from bottom to top
N During the lookup, the cursor moves to the next
Shift+n During the lookup process, the cursor moves to the previous
:%s/"character to be replaced"/"substitution character" Replace All
: S/"character to be replaced"/"substitution character" Replace the cursor where you are moving forward
: n,m S/"character to be replaced"/"substitution character" Replace from n lines until m rows

  

Common basic commands for Linux VI vim

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.