v Character-wise visual mode
V Line-wise visual mode
Ctrl-V Block-wise visual mode
gv Go to the previous visual mode
- 类似于选中功能
- 利用o可以扩大选中范围(光标向前向后)
- 选中后删除:是先名词,后动词
案例,a first-level markdown header ("===")的制作:
- 首先打:
Chapter One - yy ,然后p
Chapter One
Chapter One - 然后到第二行,select it with line-wise visual mode
- r=
进行替换
Adding Text On Multiple Lines
在每行末尾加分号
- Ctrl-V jj
- $
- A ;
- <Esc>
注:有两种方法可以从block-wise visual mode进入insert mode。一种是A—— enter the text after the cursor。另一种是I——enter the text before the cursor。不要和从正常模式进入插入模式搞混淆:A (append text at the end of the line) and I (insert text before the first non-blank line)
另一种方法,用正常模式
- vjj
- :normal! A;
Incrementing Numbers
Vim has Ctrl-X and Ctrl-A commands to decrement and increment numbers.
- Ctrl-V 3j
- g Ctrl-A
increment letters的方法:
set nrformats+=alpha
- nrformats选项指示Vim哪些base被认为是Ctrl-A和Ctrl-X的“数字”,以增加和减少base。
- 通过添加alpha,一个字母字符现在被认为是一个数字
选择最后的视觉模式区域
- gv可以快速高亮最后一个视觉模式高亮。
- 还可以使用这两个特殊标记转到最后一个视觉模式的开始和结束位置
`< Go to the first place of the previous visual mode highlight
`> Go to the last place of the previous visual mode highlight
Entering Visual Mode From Insert Mode
Ctrl-O v
Select Mode
Vim有一个类似于可视模式的模式,称为选择模式
gh Character-wise select mode
gH Line-wise select mode
gCtrl-h Block-wise select mode
选择模式比Vim的可视模式更接近于模拟常规编辑器的文本高亮显示行为。
对比这个选择模式和视觉模式:如果你用逐行视觉模式(V)高亮一行文本并键入“y”,高亮的文本不会被删除,而是被字母“y”取代,它会被拖动。您不能在选择模式下对高亮显示的文本执行普通模式命令
网友评论