当前位置:网站首页>VIM command mode and input mode switching
VIM command mode and input mode switching
2022-07-07 11:32:00 【Full stack programmer webmaster】
vi Editor
vi yes UNIX And the class UNIX Environment can be used to create a file screen editor .vi There are two working modes : Command mode and text input mode . start-up vi Need to enter vi, Press [Spacebar] Key and enter the file name and press enter .
Switch mode key
vi Switch from command mode to text input mode . Each key makes vi Enter text input mode . Press [ESC] Keying vi Return from text input mode to command mode .
surface 1 Lists vi Command keys and their functions for switching from command mode to text input mode .
surface 1 Command key to switch to text input mode
key | function |
|---|---|
i | Enter the text... To the left of the cursor |
I | Enter the text at the beginning of the line where the cursor is located |
a | Enter the text... To the right of the cursor |
A | Enter the text at the end of the line where the cursor is located |
o | Add a new line to the line next to the cursor , The cursor is at the beginning of the new line |
O | Add a new line to the line where the cursor is , The cursor is at the beginning of the new line |
explain :1. The position of the cursor is underlined (═) mark .
2. The current line refers to the line where the cursor is located .
Exit command
There is only one way to enter vi, But there are several ways to quit vi, The choice of exit method depends on how to deal with the edited file .
except ZZ Outside command , These orders are all based on : Start , use [Return] End command line . surface 2 Lists vi The exit command of the editor and its functions .
surface 2 vi Exit command of editor
key | function |
|---|---|
:wq | Save the file , sign out vi Editor |
:w | Save the file , But don't quit vi Editor |
:q | sign out vi Editor |
:q! | Don't save files , sign out vi Editor |
ZZ | Save the file , sign out vi Editor |
Text modification key
These keys are only available in command mode . surface 3 Lists vi The exit command of the editor and its functions .
surface 3 In command mode vi Editor text modification key
key | function |
|---|---|
x | Delete the character specified by the cursor position |
dd | Delete line with cursor |
u | Undo the most recent change |
U | Undo all changes made to the current line |
r | Replace a character at the cursor position |
R | Replace the character starting from the cursor position , Change at the same time vi To text input mode |
.( spot ) | Repeat the last modification |
Cursor movement command
In command mode , These keys move the cursor in the document . surface 4 Lists vi The exit command of the editor and its functions .
surface 4 vi Cursor movement key
key | function |
|---|---|
h or [ ] | Move the cursor one space to the left |
j or [ ] | Move the cursor down one space |
k or [ ] | Move the cursor up one space |
l or [ ] | Move the cursor one space to the right |
$ | Move the cursor to the end of the current line |
w | Move the cursor one word to the right |
b | Move the cursor one word to the left |
e | Move the cursor to the end |
0( zero ) | Move the cursor to the beginning of the current line |
[Return] key | Move the cursor to the beginning of the next line |
[Spacebar] key | Move the cursor one digit to the right |
[Backspace] key | Move the cursor one bit to the left |
Be careful : Avoid using cursor keys in text input mode ( Arrow keys ). Because in some systems , Cursor keys are interpreted as normal ASCII character . If you use cursor keys in text input mode , So the corresponding ASCII Characters will be inserted into the file .
Cut and paste keys
These keys are used to rearrange the text in the user file , stay vi Available in command mode . surface 5 Lists vi Editor's cut and paste keys and their functions .
surface 5 vi Editor's cut and paste keys
key | function |
|---|---|
d | Delete the text in the specified position , Coexist in the temporary buffer . have access to put The operator (p or P key ) Access this buffer |
y | Copy the text at the specified location to the temporary buffer . have access to put The operator accesses this buffer |
P | Place the contents of the specified buffer above the current cursor position |
p | Place the contents of the specified buffer under the current cursor |
Page turning key
The page key is used to scroll through the user's files in large blocks , stay vi Available in command mode . surface 6 Lists vi Page turning key of editor and its functions .
surface 6 vi Page turning key of editor
key | function |
|---|---|
[Ctrl-d] | Move the cursor down to the end of the file , Usually every time you move 12 That's ok |
[Ctrl-u] | Move the cursor up to the file header , Usually every time you move 12 That's ok |
[Ctrl-f] | Move the cursor down to the end of the file , Usually every time you move 24 That's ok |
[Ctrl-b] | Move the cursor up to the file header , Usually every time you move 24 That's ok |
Three common patterns :Normail Mode( Command mode ),Insert Mode( The input mode ) and Visual Mode( View mode ). Switching between command mode and input mode Append,Insert,Replace,Subsitute Write it down as AIRS, This memory method is particularly convenient , The English word means air ,vim Switching between command mode and input mode is like air , Immaterial .
Editing text is nothing more than basic character input and switching cursor position , At ordinary times, cursor switching is realized through the up, down, left and right keyboards on the keyboard , Although it is very convenient for the keyboard to switch the cursor up, down, left and right , But is it necessary to move from our keyboard gestures , and vim You don't have to move at all , adopt hjkl. h: Move one position to the left j: The next line k: One line up l: Move one position to the right
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/113812.html Link to the original text :https://javaforall.cn
边栏推荐
- How much do you know about excel formula?
- [encapsulation of time format tool functions]
- OneDNS助力高校行业网络安全
- 问下flinkcdc2.2.0的版本,支持并发,这个并发是指多并行度吗,现在发现,mysqlcdc全
- JS add spaces to the string
- Suggestions on one-stop development of testing life
- Eth trunk link switching delay is too high
- QT | multiple windows share a prompt box class
- R语言使用quantile函数计算评分值的分位数(20%、40%、60%、80%)、使用逻辑操作符将对应的分位区间(quantile)编码为分类值生成新的字段、strsplit函数将学生的名和姓拆分
- 高考作文,高频提及科技那些事儿……
猜你喜欢

What is cloud computing?
![[system design] index monitoring and alarm system](/img/8e/9c4c168f7f2b8e1f0786a5fe158544.png)
[system design] index monitoring and alarm system

Array object sorting
![Verilog design responder [with source code]](/img/91/6359a2f3fa0045b4a88956a475488c.png)
Verilog design responder [with source code]

OneDNS助力高校行业网络安全

Talk about SOC startup (11) kernel initialization

In my limited software testing experience, a full-time summary of automation testing experience

聊聊SOC启动(六)uboot启动流程二

JS add spaces to the string

Use metersphere to keep your testing work efficient
随机推荐
Qt 实现容器的DELETE的方式
Verilog 实现数码管显视驱动【附源码】
【问道】编译原理
STM32 entry development NEC infrared protocol decoding (ultra low cost wireless transmission scheme)
Verilog design responder [with source code]
Creative information was surveyed by 2 institutions: greatdb database has been deployed in 9 places
在我有限的软件测试经历里,一段专职的自动化测试经验总结
核舟记(一):当“男妈妈”走进现实,生物科技革命能解放女性吗?
深度学习秋招面试题集锦(一)
R语言使用magick包的image_mosaic函数和image_flatten函数把多张图片堆叠在一起形成堆叠组合图像(Stack layers on top of each other)
博客搬家到知乎
There are ways to improve self-discipline and self-control
毕业季|与青春作伴,一起向未来!
软件设计之——“高内聚低耦合”
Talk about SOC startup (11) kernel initialization
JS array delete the specified element
STM32入门开发 编写DS18B20温度传感器驱动(读取环境温度、支持级联)
浙江大学周亚金:“又破又立”的顶尖安全学者,好奇心驱动的行动派
Half of the people don't know the difference between for and foreach???
通过 Play Integrity API 的 nonce 字段提高应用安全性