Vim Common commands

Source: Internet
Author: User

1. Exit VI

:wq!   强制保存退出:wq    保存退出:x     保存退出(作用和:wq一样)ZZ     ZZ大写,并且不是在命令行模式(作用跟:wq一样):q     退出:q!    强制退出

2. Mobile

h   在当前行向左移动一个字符j   移动到下一行k   移动到上一行l   在当前行向右移动一个字符Ctrl+f  向前滚动一页Ctrl+b  向后滚动一页:n  将光标定位到第n行:$ 将光标定位到最后一行0   将光标定位到本行行首$  将光标定位到本行行尾G   将光标定位到文章的最后一行(与:$功能相同)H   将光标定位到屏幕顶端M   将光标定位到屏幕中间L   将光标定位到屏幕底端

3. Search

/   后面跟要搜索的东西,在文件中向前搜索?   后面跟要搜索的东西,在文件中向后搜索n   向前重复搜索N   向后从发搜索

4. Copying

yy  复制当前行nyy 复制光标当前行到当前行以下n-1行:1,100 co 200   将1~100的内容复制到第200行:100,102 co 200 $  将100~102的内容复制到最后一行

5. Paste

p   粘贴到当前行P   粘贴到当前行的上一行

6. Delete, cut

dd  删除当前行ndd 与nyy相似dw  删除一个词ndw 与ndd相似x   删除一个字符nx  删除n个 字符dG  删除当前光标到文件尾的所有内容d0  删除当前光标到本行行首的所有内容d$ 删除当前光标到本行行尾的所有内容:1,100d 删除1~100:100d   删除第100行:1,100 mo $    将1~100行的内容移到最后一行

7. Insert

i   在当前位置的字符前面进入插入模式l   在当前行的开头进入插入模式a   在当前位置的字符后面进入插入模式A   在当前行的结尾进行插入o   在当前行下面打开一个新行进行插入O   在当前行上面打开一个新行进行插入

8. Revocation

u   撤销上一次的修改

9. Replace

regexp  是要匹配的样式replacement 是要替换的字符串*:s/regexp/replacement 替换当前所出现的第一个样式(将第一个匹配到的regexp替换成replacement):s/regexp/replacement/g 替换当前所有行所有的匹配:%s/regexp/replacement/g 替换文件中所有匹配样式:.  命令是重复上一命令

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.