"Vim" vim common commands

Source: Internet
Author: User

Move:

h or LEFT ARROW key (←) #光标向左移劢一个字符
J or DOWN ARROW key (↓) #光标向下移劢一个字符
K or Up ARROW key (↑) #光标向上移劢一个字符
L or right ARROW key (→) #光标向右移劢一个字符

0 #数字0, move to the first character of the bank

$ #移动到本行最后一个字符处

GG #移动到第一行

G #移动到最后一行

ng or: N #移动到第N行

W #到下一个单词的开头

E #到下一个单词的结尾, the first action to the end of the current word

b #到前一个单词的开头, first action to the beginning of the current word

* #向前 (end of file) search for the word in the cursor

# #向后 (beginning of file) search for the word in the cursor

% #向前 (end of file) search for the symbol where the cursor is located, including (, {, [. You need to move the cursor to the parentheses first.

 

Search and Replace:

  /word #向光标乊下寻找一个名称为 Word String. For example, in the file search Vbird This string, you can enter/vbird!


? Word #向光标之上寻找一个字符串名称为 Word's string.


N #这个 N is the English key. Represents "repeating the previous search action". Bowl example, if we have just executed/vbird to search Vbird This string, then press N, will continue to search down the next string named Vbird. If the Vbird is executed, then pressing N will continue to search for the string named Vbird!


N #这个 N is the English key. In contrast to N, the previous search action for "reverse". For example/vbird, pressing N means "up" to search for Vbird.


: n1,n2s/word1/word2/g #n1 and N2 are numbers. Look for the string word1 between N1 and N2, and replace the string with Word2! For example, search for vbird between 100 and 200 rows and replace it with Vbird: ": 100,200s/vbird/vbird/g".


: 1, $s/WORD1/WORD2/GC # look for the word1 string from the first line to the last line and replace the string with Word2! and display the prompt character before the District to confirm (confirm) whether the user needs to be replaced.

:%s/word1/word2/g #将整篇文章的word1取代为word2. % represents the whole article

R #替换光标所在的字符

R #替换知道按esc退出

Insert:

I #在光标前插入

I #在当前行第一个非空字符前插入;

a #在光标后插入;

A #在当前行最后一个飞控字符后插入;

o #在下面新建一行插入;

O #在上面新建一行插入;

Delete, copy, and paste:

X,x #在一行字当中, X is to remove one character backwards (equivalent to [del] key) and X to delete a character (equivalent to [backspace], which is the backspace)

Delete Action D:

DD #删除光标所在的那一整行, and copies the contents to the Clipboard.

DNG #删除光标所在行到第N行的所有数据

DG #删除光标所在行到最后一行的所有数据

d$ or D #删除光标所在处到该行最后一个字符的所有数据

D0 #删除光标所在处到该行第一个字符的所有数据

DW #删除光标所在处到当前单词的最后一个字符的所有数据

Copy Action y:

yy or y #复制光标所在的那一整行, and copies the contents to the Clipboard.

Yng #复制光标所在行到第N行的所有数据

YG #复制光标所在行到最后一行的所有数据

y$ #复制光标所在处到该行最后一个字符的所有数据

Y0 #复制光标所在处到该行第一个字符的所有数据

 

Paste:

P,p #P在光标之前粘贴, P is pasted after the cursor

Indent:

<< indent one shiftwidth to the left

>> indent one shiftwidth to the right

=-> #自动缩进光标所在行

Resources:

1. "Brother Bird's Linux private cuisine"

2.http://blog.csdn.net/donahue_ldz/article/details/17139361

http://detail.tmall.com/item.htm?spm=a1z10.5-b.w4011-3260227765.78.5PxFmO&id=22506544068&rn= 9fbe4bc98086da331b95c8c85e86710b&abbucket=18&skuid=69046829144

"Vim" vim common commands

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.