当前位置:网站首页>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
边栏推荐
- 【密码学/密码分析】基于TMTO的密码分析方法
- SC7A20(士兰微-加速度传感器)示例
- 高维高斯分布基础
- 欧拉系统(euleros):升级Mysql
- Game Security 03: A Simple Explanation of Buffer Overflow Attacks
- WAASAP WebClient UI页面标签的决定逻辑介绍
- Super like the keyboard made from zero, IT people love it
- The kernel of the decompression process steps
- MYSQL transactions
- Luogu P3373: Segment tree
猜你喜欢
随机推荐
Rasa 3.x Learning Series - Using Lookup Tables to Improve Entity Extraction
Soft Exam Senior System Architect Series: Basic Knowledge of Information Systems
Basic usage concepts of vim
Inheritance Considerations
Solve the problem that when IDEA creates a new file by default, right-click, new, there is no XML file
现代企业架构框架1
Introduction to machine learning how to?
Exam preparation plan
js 实现复制功能
Introduction to the decision logic of WAASAP WebClient UI page labels
【Cryptography/Cryptanalysis】Cryptanalysis method based on TMTO
Summary of MVCC
leetcode:1648. 销售价值减少的颜色球【二分找边界】
July Bootcamp (Day 31) - Status Compression
JVM面试题总结(持续更新中)
Application of integrated stepper motor in UAV automatic airport
Daily practice of LeetCode - Circular linked list question (interview four consecutive questions)
MVCC总结
Rasa 3.x Study Series - Rasa - Issues 4898 Study Notes
ROS2 series of knowledge (4): understand the concept of [service]








