当前位置:网站首页>VIM common commands
VIM common commands
2022-06-11 18:16:00 【AlbertOS】
introduce
As long as it involves Linux Programming in the environment is inseparable from vim This text editing tool , Now let's put some commonly used vim Summarize the operations and commands
vim Working mode of
To enter vim The command first needs to know what the current text editing mode is ,vim Generally speaking, there are 6 Working mode :
- Common mode : Use vim Default mode for opening files ( Also called command mode , Allow the user to browse the code through various commands 、 Scroll screen and other operations , After all, use vim You can ignore the mouse )
- Insertion mode ( Edit mode ): Press... In normal mode
i、a、oYou enter the editing state - Command line mode : Enter a colon in normal mode
:, You enter command line mode , It's like:q Exit without saving、:wq Save and exitIt's used a lot - Visualization mode : Tap on the front disc in normal mode v key , Enter the visualization mode , Then move the cursor to select a piece of text , It is often used to copy text 、 Paste 、 Delete and other operations .
- Replace mode : If we want to change a character , There is no need to enter the insert mode first , Delete , Then enter new characters , Directly in normal mode , Knock R Key can be directly replaced .
- EX Pattern : Similar to command line mode , You can run multiple commands at once
vim Various working modes of the can be switched through different keys , Users use it uniformly ESC Return to normal mode .
Common commands
Common mode
| command | explain |
|---|---|
| Single character movement : | I found that using the mouse and the up, down, left and right buttons can also , More in line with our habits |
| h | Move to the left |
| l | To the right |
| j | Move down the |
| k | Move up |
| xh | Move to the left x Character distance |
| Word movement : | |
| w | Move the cursor to the beginning of the next word |
| b | Move the cursor to the beginning of the previous word |
| e | Move the cursor to the end of the next word |
| E | Move to the end of the word ( Ignore punctuation ) |
| ge | Move the cursor to the end of the previous word |
| 2w | Specify the number of moves |
| OK, move : | |
| $ | Move the cursor to the end of the current line |
| 0 | Move the cursor to the beginning of the current line |
| ^ | Move the cursor to the first non empty character on the current line ( The current line position is not a null character ) |
| fx | Move the cursor to the first character of the current line x On |
| 3fx | Move the cursor to the... Before the voyage 3 Characters x On |
| tx | Move the cursor to the target character x On the previous character of a |
| % | Used to move between symbols , It will be in a pair ()、[]、{} Jump between |
| Text block movement : | |
| ( | Move to the beginning of the current sentence |
| ) | Move to the beginning of the next sentence |
| { | Move to the beginning of the current paragraph |
| } | Move to the beginning of the next paragraph |
| [[ | Move to the beginning of the current section |
| ]] | Move to the beginning of the next section |
| Move around the screen | |
| xG | Jump to the specified page x That's ok ,G Move to file, press end ,``(2 Secondary single quotation mark ) Return to the position before the jump |
| gg | Move to the beginning of the file |
| x% | Move to the middle of the file , Just use 50% |
| H | Move to home |
| M | Move to the middle of the screen |
| L | Move to the end of a screen |
| ctrl+G | View the current location status |
Insertion mode
| command | explain |
|---|---|
| Text insertion operation | |
| i | Insert a character in front of the current cursor |
| a | Appending characters after the current cursor |
| o | Insert a character at the beginning of the line next to the current cursor |
| I | Add text at the beginning of a line |
| A | Add text at the end of a line |
| O | Insert text one line above the current line of the cursor |
| s | Delete the character at the current cursor and enter insert mode |
| S | Delete the line where the cursor is , And go into insert mode |
| u | Undo modify |
| Character deletion | |
| x | Delete the character at the current cursor |
| X | Delete the character to the left of the current cursor |
| Delete words | |
| dw | Delete a word ( From the cursor to the space ) |
| daw | No matter where the cursor is , Delete the whole word where the cursor is located ( Include white space characters ) |
| diw: | Delete entire word text , But keep the space character and don't delete it |
| d2w | Delete... From the beginning of the current cursor 2 Word |
| d$ | Delete the entire text from the cursor to the end of a line |
| d0 | Delete all words from the cursor to the beginning of a line |
| dl | Delete the character at the current cursor =x |
| dh | Delete the character to the left of the current cursor =X |
| Line delete | |
| dd | Delete the entire line at the current cursor =D |
Command mode
| command | explain |
|---|---|
| :U | Restore the original appearance of the whole line ( The text state when the file is opened ) |
| :q | If the file has not been modified , immediate withdrawal |
| :q! | The file has been modified , Discard the modification and exit |
| :wq | The file has been modified , Save the changes and exit |
| :e! | Abandon modification , Return to the state when the file was opened |
summary
vim There are many commands that don't need to be memorized , As long as this command is enough for you to write files normally ~~

边栏推荐
- Jsfinder, wafw00f installation, nmap configuration (msvcr120.dll file is missing)
- Comparison of mongoose in express, KOA and egg
- Say no to credit card fraud! 100 lines of code to realize simplified real-time fraud detection
- HashSet集合存储学生对象并遍历
- RadioGroup动态添加RadioButton
- Cryptology Summary
- 【无标题】
- How to learn and self-study
- 安全领域常规术语
- Is it good or not to open a stock account on the flush? Is it safe?
猜你喜欢
随机推荐
SQL报错注入1
软件需求工程复习
Install MariaDB 10.5.7 (tar package installation)
264 Concepts
关于keil中,while循环条件不成立却无法跳出的问题
Implementation of servlet file upload function (Commons fileUpload)
[collect first and use it sooner or later] 49 Flink high-frequency interview questions series (I)
[collect first and use it sooner or later] 100 Flink high-frequency interview questions series (II)
Winter vacation daily question (improvement group) [end of week 4]
zabbix怎样自定义mysql监控项并触发告警
[C语言]用结构体把输入的指定分数范围内的学生输出
Spring 2021 daily question [week3 not finished]
【C】 ATOI function implementation +offsetof implementation + exchange binary odd and even digits
Using packstack to quickly install openstack
Acwing game 40 [End]
【C】 Compilation preprocessing and environment
Retrofit source code analysis
Mysql8 installation, Navicat installation, sqli labs setup
viso的常见操作
PIL-Pillow图像处理【1】-安装与新建

![[Golang]力扣Leetcode - 349. 两个数组的交集(哈希表)](/img/92/03de54c9f08eae5bc920b04d2b8493.png)







