当前位置:网站首页>Three modes of vim
Three modes of vim
2022-08-05 06:08:00 【Magic star】
Three modes of vim:
The relationship between the three modes of vim

Command mode: the mode entered at the beginning
Move the cursor (up, down, left and right)
1, Jump between lines: the beginning goes directly to the end (end or $), and the end goes directly to the beginning(^ or 0)
2, Jump between multiple lines: last line (G), first line (gg), 10th line (10G)
Copy whole line (yy), copy multiple lines (number yy), copy one word (yw)
Paste: p (paste to the next line where the cursor is), (big) P (the previous line where the cursor is)
Cut the whole line (dd), cut the number of lines (#dd)
Delete
1. Delete a single letter: x del
2. Delete the cursor to the beginning:d^
3. Delete the cursor to the end: d$
4. Delete a word: dwUndo once (u), undo all (big U)
Replacement mode (r): one character can be replaced, no additional characters can only be replaced
Big R: the fourth mode, the replacement mode (whatever you type will always replace the characters you type)
Exit: zzsave exit
Find content (/the character you want), n (down), N (up)
Display line number: set nu
Understand:
Jump to the current page:
H: Top of page
M: Middle line of page
L: Bottom of page
zt: Move the current line where the cursor is located to the top of the screen
zz: move the current line where the cursor is located to the middle of the screen
zb: move the current line where the cursor is located to the bottom of the screen
Input Mode
- i: insert, type where the cursor is
- I: Type at the beginning of the line where the current cursor is located
- a: append, enter after the cursor position
- A: Type at the end of the line where the current cursor is located
- o: Opens a new line below the current cursor line
- O: open a new line above the current cursor line
Last line mode
| Options | Action |
|---|---|
| set all | Show all command options |
| set nu | Show line numbers |
| set noun | Close line numbers |
| set cul | Show underline |
| set nocul | Turn off underline |
| set list | Show hidden characters |
| set key=the secret you set | Encryption |
| set key=Nothing to lose | Release Password |
| set ai | Auto-indent |
| w | Save |
| q | Exit |
| ! | Mandatory |
| w +path | Save As |
| r + file path | Add another file to the current file editor |
| . ! Command | Read the command result and write it to the current file |
Find Replace in Last Line Mode
Range s/old characters/new characters/modifiers
Scope
- Do not write, the default cursor current line
- #, # a certain line to a certain line (# represents the number 2, 20: 2 to 20 lines)
- %, representing the full text
s
Command search (search)
/ , #, @
Separator
Old characters
What you are looking for or what you are replacing (you can use *^)
New character
The character you want to replace the old character with (* cannot be used)
Modifier
i: case insensitive
g: all hits in the entire line are replaced (if not g, only the first hit in the entire line is replaced)
In the configuration file, the behavior comments beginning with # do not take effect
Begin all lines with #(:%s/^/#/g)
The delimiter can be / # @ can be used (% s#/sbin/nologin#/zz/#g)
边栏推荐
猜你喜欢
随机推荐
Unity huatuo 革命性热更系列1.3 huatuo示例项目源码分析与启发
小度 小度 在呢!
每日一题-合并两个有序链表-0720
【UiPath2022+C#】UiPath 练习-数据操作
D41_缓冲池
D39_欧拉角与四元数
每日一题-最长有效括号-0724
【UiPath2022+C#】UiPath控制流程概述
什么?CDN缓存加速只适用于加速静态内容?
D39_坐标转换
调用TensorFlow Objection Detection API进行目标检测并将检测结果保存至本地
【Day8】使用LVM扩容所涉及的命令
【Day8】磁盘及磁盘的分区有关知识
电子产品量产工具(2)- 输入系统实现
spark源码-任务提交流程之-1-sparkSubmit
论那些给得出高薪的游戏公司底气到底在哪里?
[Pytorch study notes] 8. How to use WeightedRandomSampler (weight sampler) when the training category is unbalanced data
入门文档04 一个任务依赖另外一个任务时,需要按顺序执行
每日一题-寻找两个正序数组的中位数-0713
LeetCode刷题之第33题








