当前位置:网站首页>VIM text editor
VIM text editor
2022-07-23 07:14:00 【Xuanxue closed disciple】
This article is about vim A record summary after learning , Most of them are about some noteworthy or common points , In detail vim I can't see instructions waiting here , There are many online , It is suggested that everyone be active Google. If the text is wrong , Hope to put forward in the comments , I will correct it in time , thank !
1、vim What are the main modes
- Command line mode
- Text insertion mode
- Bottom line mode
2、vim test.sh Which mode is the first to enter after
Just entered vim After being in Command line mode
3、 Mode switch
There are generally three ways to switch from command line mode to text insertion mode , The text insertion mode and then switch back to the command line mode directly ESC Just quit ( Don't knock one word at a time , I draw a picture directly , It's also clearer to see in this way )

4、 sign out vim And save
This needs to be switched to Bottom line mode To operate . If you are currently in text insertion mode , Then you first need to switch the current mode to Command line mode , Then press ‘ : ’ ( In English ), At this time, a command line will appear under the terminal , Then choose the operation you want :
- ‘ w filename ’ — Document to filename Save the file name of
- ‘ wq ’ — Save the file and exit vim
- ‘ q ’ — File not saved and exit vim
- ‘ q! ’ — Files are not saved and forced to exit vim
Actually ‘ ! ’ The usage of is not rigid ,‘ wq ’ You can also add ‘ ! ’, Used to express as : File saving and forced exit vim, Its main meaning is to express Enforcement It means
4、 Some shortcut keys commonly used in command line mode
The following shortcut keys are Press *, Such as : Add content at the end of a line , You can press... On the keyboard in command line mode A; Delete the content from the specified position to the end of the line , Just stop the cursor in front of the sentence to be deleted , Press on the keyboard in turn d -> $, wait .
【1】 Add at the end of the line
- A
【2】 Delete words
- Place the cursor in front of the word to be deleted , Press in turn d and W( The following introduction is directly abbreviated as d -> W)
- Place the cursor in front of the word to be deleted , At the same time, ignore the space in front of the word :d -> e
【3】 Delete the content from the specified position to the end of the line
- d -> $ ( Just stop the cursor in front of the sentence to be deleted )
【4】 Quickly jump to the beginning of the line
- 0
【5】 Delete current row
- d -> d
- To delete continuously 2 Line or more lines , Just add the row number parameter , namely 2 -> d -> d
【6】 Undo change
- Undo the previous change :u
- Undo the change of the whole line :U
- Undo the undo operation of the previous step :Ctrl + R
【7】 Jump
- Top jump :Ctrl + g ( An input box appears at the bottom of the terminal ), And then again + g + g
- Bottom jump :Ctrl + g, And then again + G
- Jump to the specified number of lines : Enter the line number directly n, And then again + G
5、 utilize vim Set the encoding format
5.1 Instructions
- :set ff — View the type of current text mode , It's usually doc and unix
- :set ff=dos — Change the text type to dos type
- :set ff=unix — Change the text type to unix type
- :set fileencoding — View the encoding of the current text
- :set fenc= code — Converts the encoding of the current text to the specified encoding
- :set enc= code — Display the text in the specified encoding , But do not modify the text encoding
5.2 Be careful
- Windows The default encoding is GBK,Linux The default encoding is utf-8
- commonly Linux File corresponding to the unix The text type of and utf-8 The coding
- Each statement needs to be executed in command line mode , Then press ‘ : ’
- Probably fileencoding This word is long , In fact, we finished fi Then you can press TAB The completion of , Save time
- Text mode type and Text coding is not a thing , Pay attention to the distinction
边栏推荐
猜你喜欢

【FAQ】应用内支付服务无法拉起支付页面常见原因分析和解决方法

Mycms we media mall v3.5 release, new free plug-ins

小黑leetcode之旅:100 相同的树

-bash: wget: 未找到命令

小程序wx.setStorageSync后,在用getStorageSync获取数据有时会获取不到

Realize OPC UA publish/subscribe single send

织梦dedecms忘记管理后台密码找回方法

谷歌云和甲骨文云“热崩了”?部署跨云容灾势在必行!

小黑leetcode之旅:590. N 叉树的后序遍历

Common operators
随机推荐
对线程池的了解与应用你掌握多少
AE常用表达式汇总「建议收藏」
局域网SDN技术硬核内幕 - 15 三 从物到人 园区用户漫游的MPLS实现
cpu温度多少正常 cpu长期100度会烧吗
EXCEL单元格公式-实现阿克曼函数计算
新浪微博头像右下角红色五角星是什么意思?如何成为新浪微博达人?
小黑leetcode之旅:341. 扁平化嵌套列表迭代器
Demo19- (to be updated)
炒股网上开户转账提示未激活存管及转账服务的解决方法(招商银行)
无法打开代理服务器提示代理服务器没有设置为完全访问该怎么办?
局域网SDN技术硬核内幕 - 前传 CPU里面有什么?
为什么我的百度账号登不上去了?百度账号无法登录现象的解决方法介绍
Cloudwego's design practice in the background platform of flybook management
谷歌云和甲骨文云“热崩了”?部署跨云容灾势在必行!
正向代理,反向代理及XFF
What if the software downloaded from the computer is not displayed on the desktop? Solve the problem that the installed software is not on the desktop
Kotlin learning quick start (8) - Delegation
Detailed explanation of CAN bus
W25q128fv translation (II)
中年危机,不敢离职的职场爸爸,该如何面对生活的苟且