当前位置:网站首页>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
边栏推荐
- Euler system (euleros): upgrade Mysql
- MYSQL query interception optimization analysis
- Rasa 3.x Learning Series - Using Lookup Tables to Improve Entity Extraction
- RTL8762DK WDG (six)
- SC7A20 (Silan Micro-Accelerometer) Example
- VPGNet
- Chain programming, packages, access
- sqlserver无法远程连接
- /usr/sbin/vmware-authdlauncher: error while loading shared libraries: libssl.so.1.0.2*Solution
- 【数据分析】基于matlab GUI学生成绩管理系统【含Matlab源码 1981期】
猜你喜欢

How is the tree structure of the device tree reflected?
![ROS2 series of knowledge (4): understand the concept of [service]](/img/14/8de92a89d9c4b6476ac37408bc7788.png)
ROS2 series of knowledge (4): understand the concept of [service]

leetcode:1562. 查找大小为 M 的最新分组【模拟 + 端点记录 + 范围合并】

Completely closed Chrome updated and in the top right corner of the tip

【数据分析】基于matlab GUI学生成绩管理系统【含Matlab源码 1981期】

MYSQL Keyword Explain Analysis

声称AI存在意识,谷歌工程师遭解雇:违反保密协议
![leetcode: 1562. Find latest grouping of size M [simulation + endpoint record + range merge]](/img/72/f52b5d3dcdb271f096c3e5108f0042.png)
leetcode: 1562. Find latest grouping of size M [simulation + endpoint record + range merge]

Cmake introductory study notes

Flink deploys and submits jobs
随机推荐
Completely closed Chrome updated and in the top right corner of the tip
Design the message queue storage MySQL form of message data
MYSQL查询截取优化分析
【历史上的今天】7 月 31 日:“缸中之脑”的提出者诞生;Wi-Fi 之父出生;USB 3.1 标准发布
RTL8762DK UART(二)
JVM面试题总结(持续更新中)
OSF understands the agile development model in one minute
MYSQL query interception optimization analysis
Rasa 3.x Study Series - Rasa - Issues 4918 Study Notes
Google "Cloud Developer Quick Checklist"; Tsinghua 3D Human Body Dataset; SenseTime "Universal Vision Framework" open class; Web3 Minimalist Getting Started Guide; Free Books for Efficient Deep Learni
Beijing suddenly announced that yuan universe big news
MVCC总结
Inheritance Considerations
WebApi 打个Attribute 统一处理异常
WAASAP WebClient UI页面标签的决定逻辑介绍
/usr/sbin/vmware-authdlauncher: error while loading shared libraries: libssl.so.1.0.2*Solution
MYSQL-批量插入数据
SC7A20 (Silan Micro-Accelerometer) Example
IDEA修改注释字体
Daily practice of LeetCode - Circular linked list question (interview four consecutive questions)