Vim笔记(3)-选择操作
Vim笔记(3)-选择操作
简介
很多时候我们都需要批量选取文本并操作, 而
Vim
的Virtual
模式提供了文本选取的功能进入
Virtual
模式后我们可以配合各种移动操作快速选取文本
选择文本的三种 Virtual
模式
v
: 进入字符选取模式, 从当前光标所指的字符进入Virtual
模式并以字符为单位选取V
: 进入行选取模式, 选取当前行并进入Virtal
模式, 以行为单位选取内容<Ctrl-V>
: 进入块选取模式, 以并行块的方式选取
练习
- 提供了两种模式下的参考答案
// 1. Remove "It is"
// Normal mode: ldtb
// Visual mode: lvtbd
// 2. better => Better
// Normal mode: ~
// Visual mode: v~
// 3. in one place, => in one place.
// Normal mode: /,<ENTER>ncl.<ESC>
// Visual mode: /,<ENTER>vc.<ESC>
// 4. delete everything after that
// Normal mode: jdd..
// Visual mode: jVjjd
start here
/
/
v
"It is better to go forward without a goal,
than to have a goal and stay in one place,
and it is certainly better than to stay in one
place without a goal.”
- The Tower of the Swallow (The Witcher #4)
- 以下的
C-V
表示<Ctrl-V>
start here
/
/
v C-V8jc<li><ESC>C-V8j$A</li><ESC>O<ol>o</ol>
- buy flour, salt and eggs
- mix two cups flour and some salt
- put a handful on flour on a flat surface
- Make sort of a volcano with the flour
- Break 3 eggs.
- The eggs are the lava in the volcano
- Slowly combine flour and eggs into a dough
- Knead the dough
- Let it rest
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.