Vim operation skills Phase 1: Basic operation skills

Source: Internet
Author: User

I have been developing in Linux recently.ProgramAlthough it is a running virtual machine, the encoding is still in windows and then compiled in Linux. I found this efficiency is relatively low. Why not encode it in Linux? Haha, the reason is that I am not very familiar with the Linux environment, but I heard that the two tools VI and Emacs in Linux are very powerful, so I decided to learn these two tools, here are some recently learned operations on VI:
First, there are three modes of VI: Normal Mode (command mode), edit mode (insert mode), and visual mode. There are also a lot of details on the Internet. How to do this is simple
Open VI and enter the normal mode (when you press the keyboard, press I, A, C, O, etc.), press I, or a enters the insert mode (at this time, you can enter characters. Note that the commands I mentioned below are all operated in the command mode ), press <ESC> or CTRL-C to return to the command mode, and then press V to enter the visual mode, which can be block selection, copy and paste operations. The following are the recently learned commands (declare that ESC, Ctrl, backspace, enter, and space are keys on the keyboard, not characters)
CTRL-H, left, backspace
Move the cursor to the left

Space, right
Move the cursor to the right

0
Move to the first character of a line

^
The first non-null character to move to the row

$
Move to the last character of the row

: F
List the full path of the current file

[Num]-
Move the num row up, for example, 5-. Move the row up.

[Num] +
Move the num row downward.

[Num] G
Move from file header to num row

[Num] %
Move to the num % location of the File

[Num] GK
Move num row from current row up

[Num] GJ
Move num row down from current row

[Num] W
Move num words backward

[Num] B
Move num forward

Ge
Move to the end of the previous word

}
Move to the next blank line

{
Move to the previous empty row

[[
Move to File Header

]
Move to the end of the file

[{
Match to the previous {

]}
Match to next}

[*
Previous /*

] *
Next */

/
Backward Search

?
Forward search

*
Match the current character downward

#
Match the current character up

GD
Goto local Declaration

GD
Goto global declaration

''
Move to the position before the jump

H
Current screen Header

M
Center of current screen

L
Bottom of current screen

CTRL-C
Same as ESC

: R!
Append the executed command to the current document

[Num] x
Delete num characters

[Num] x
Delete the previous num characters

R
Modify Mode

~
Converts the current character to uppercase.

V-u
Converts the current character to lowercase.

G ~
Uppercase/lowercase letters

>
Backward indent

<
Forward indent

CTRL-D
Scroll down the half screen

CTRL-U
Scroll up half screen

CTRL-G
Display current file and row

: + [Num]
Move to the bottom num row of the row where the cursor is located

: E File
Edit an object

: Pwd
Show current path

: CD path
Go to path

: Enew
Edit a new untitled Buffer

: CD-
Return to the previous path of the current path.

: F filename
Modify the file name to the new filename

CTRL-W
Split the form and go to the definition

CTRL-W F
Split the form and go to the file

CTRL-W o
Maximize the current form

CTRL-W J
Move to the previous buffer window

CTRL-W K
Move to the next buffer window

Zf <enter>
Collapse current Block

ZD
Delete current collapse

ZC
Disable current collapse

Zo
Open current fold

Because there are a lot of VI commands, here we will list the operations that can help you complete basic editing tasks. Haha, at least give new users a perceptual knowledge. I am also a newbie ^_^!

 

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.