当前位置:网站首页>Basic use of vim - command mode
Basic use of vim - command mode
2022-08-01 01:34:00 【HUAWEI CLOUD】
vim command mode command set
- Press "i" to switch to insert mode "insert mode", and press "i" to enter insert mode to start inputting the file from the current position of the cursor;
- Press "a" to enter insert mode, and start typing text from the position next to the current cursor position;
- After pressing "o" to enter insert mode, a new line is inserted, and the text is entered from the beginning of the line.
- Switch from insert mode to command mode
- Press
esc
- Press
- Move the cursor
- vim can directly use the cursor on the keyboard to move up, down, left and right, but regular vim uses lowercase English letters "h", "j", "k",
"l" to control the cursor left and down respectively, up, right move one space- Remember:
- The h key is on the left side, and the l on the left and right sides means left and right
- j:jump jumps down
- k:king is on top
- Press "G": move to the end of the article
- Press "shift+ $": move to the "end of line" of the line where the cursor is located
- Press "shift+^": move to the "start of line" of the line where the cursor is located
- Move the cursor forward and backward in units of words
- Press "w": the cursor jumps to the beginning of the next word (move left, move forward)
- Press "e": the cursor jumps to the end of the next word
- Press "b": the cursor returns to the beginning of the previous word (move right, move back)
- Press "#l": the cursor moves to the #th position of the line, such as: 5l, 56l
- Press [gg]: go to the beginning of the text (jump to the start line)
- Press [shift+g]: enter the end of the text (jump to the end line)
- n+shift+g : jump to the specified line
- Press "ctrl" + "b": the screen moves to the "back" page
- Press "ctrl" + "f": the screen moves "forward" one page
- Press "ctrl" + "u": the screen moves to the "back" half page
- Press "ctrl" + "d": the screen moves to the "forward" half page
- vim can directly use the cursor on the keyboard to move up, down, left and right, but regular vim uses lowercase English letters "h", "j", "k",
- Delete text
- 「x」: lowercase x, each time you press, delete a character at the cursor position (lowercase x: delete from left to right)
- Support nx to delete the cursor position and n characters after it
- "#x": For example, "6x" means to delete the 6 characters "behind (including itself)" where the cursor is located
- "X": Capital X, each press deletes one character "before" the cursor position (Capital X: delete from right to left)
- Support nX to delete the cursor position and its n characters ahead
- "#X": For example, "20X" means to delete 20 characters "before" the cursor position
- "dd": delete the line where the cursor is located
- Support ndd to delete n lines at a time, including the current line
- “#dd”: delete # lines from the line where the cursor is located
- 「x」: lowercase x, each time you press, delete a character at the cursor position (lowercase x: delete from left to right)
- Copy
“yw”: Copy the characters from the cursor position to the end of the word into the buffer.
“#yw”: copy # words to buffer
"yy": Copy the line under the cursor to the buffer.
"#yy": For example, "6yy" means to copy 6 lines of text "counting down" from the line where the cursor is located.
- nyy means to copy n lines of text from the line where the cursor is located, including the current line
"p": Pastes the characters in the buffer to the cursor position.
np: Repeat n lines at a time
Note: All copy commands related to "y" must be combined with "p" to complete the copy and paste function.
First yy, then directly np: copy n lines after the cursor position
p after dd: cut
- Replace
- “r”: replace the character at the cursor
- Support nr to replace n characters later
- "R": replace the character at the cursor position until the "ESC" key is pressed
- shift + r replace mode, directly replace multiple contents
- “r”: replace the character at the cursor
- Undo the last action
- “u”: Undo the wrong operation,If you execute a command by mistake, you can press “u” immediately to go back to the previous operation.Press 'u' multiple times to perform multiple restores
- "ctrl + r": Undo redo
- Change
- "cw": change the word where the cursor is to the end of the word
- "c#w": For example, "c3w" means change 3 words
- shift + ~ : quick case switch
- Jump to the specified line
- "ctrl"+"g" lists the line number of the line where the cursor is located
- "#G": For example, "15G", which means move the cursor to the beginning of line 15 of the article
边栏推荐
- Fat interface in JQESAP system
- Chinese version of Pylint inspection rules
- 蓝图:杨辉三角排列
- Item 36: Specify std::launch::async if asynchronicity is essential.
- Soft Exam Senior System Architect Series: Basic Knowledge of System Development
- Talking about hardware device computing storage and data interaction
- Summary of JVM interview questions (continuously updated)
- The principle of virtual inheritance
- MYSQL-Batch insert data
- MVCC总结
猜你喜欢
Super like the keyboard made from zero, IT people love it
MYSQL查询截取优化分析
IDEA调试
leetcode:1648. 销售价值减少的颜色球【二分找边界】
Academicians of the two academies speak bluntly: Don't be superstitious about academicians
MYSQL关键字Explain解析
【Cryptography/Cryptanalysis】Cryptanalysis method based on TMTO
RTL8762DK 使用DebugAnalyzer(四)
Blueprint: Yang Hui's Triangular Arrangement
Beijing suddenly announced that yuan universe big news
随机推荐
更换树莓派内核
如何编辑epub电子书的目录
OSF一分钟了解敏捷开发模式
RTL8762DK RTC(五)
Four ways the Metaverse is changing the way humans work
Item 36: Specify std::launch::async if asynchronicity is essential.
OSD read SAP CRM One Order application log way of optimization
sqlserver cannot connect remotely
OSD读取SAP CRM One Order应用日志的优化方式
Device tree - conversion from dtb format to struct device node structure
How is the tree structure of the device tree reflected?
值传递还是引用传递(By Value or By Reference)
解决IDEA默认情况下新建文件时,右击,new,没有XML文件的问题
The principle of virtual inheritance
Rasa 3.x 学习系列-使用查找表改进实体提取
【元胞自动机】基于matlab界面聚合元胞自动机模拟【含Matlab源码 2004期】
gateway gateway cross domain
内核的解压缩过程详解
WebApi 打个Attribute 统一处理异常
IDEA修改注释字体