How can you insert when you are in visual block mode (by pressing ctrl-V) in Vim?
在Vim中处于可视块模式(按ctrl-V)时,如何插入?
4 个解决方案
#1
115
Try this
试试这个
After selecting a block of text, press Shift+i or capital I.
选择文本块后,按Shift+i或大写i。
Lowercase i will not work.
小写的我不工作。
If this doesn't work...
如果这不起作用……
Check if you have +visualextra
enabled in your version of Vim.
检查你的Vim版本是否有+visualextra功能。
You can do this by typing in :ver
and scrolling through the list of features. (You might want to copy and paste it into a buffer and do incremental search because the format is odd.)
您可以输入:ver并在特性列表中滚动。(您可能想要复制粘贴到缓冲区中,并进行增量搜索,因为格式很奇怪)。
Enabling it is outside the scope of this question but I'm sure you can find it somewhere.
启用它不在这个问题的范围之内,但我相信你可以在某个地方找到它。
#2
19
You might also have a use case where you want to delete a block of text and replace it .
您还可能有一个用例,您希望删除一个文本块并替换它。
Like this
像这样
Hello World
Hello World
You can visual block select before "W" and hit I - Type "Cool" - Hit ESC and then delete "World" by visual block selection .
你可以在“W”之前进行视觉区块选择,点击I - Type“Cool”-点击ESC,然后通过视觉区块选择删除“World”。
Alternatively, the cooler way to do it is to just visual block select "World" in both lines. Type c for change
. Now you are in the insert
mode. Insert the stuff you want and hit ESC. Both gets reflected with lesser keystrokes.
另一种更酷的方法是只在两行中选择“World”。c型变化。现在您处于插入模式。插入你想要的东西,点击ESC。这两种方法都可以通过更小的击键来实现。
Hello Cool
Hello Cool
#3
10
- press ctrl and v // start select
- 按ctrl + v /开始选择
- press shift and i // then type in any text
- 按shift键,输入任何文本
- press esc esc // press esc twice
- 按esc // /按esc两次
#4
1
if you want to add new text before or after the selected colum:
如果您想在选定的colum之前或之后添加新文本:
- press ctrl+v
- 按ctrl + v
- select columns
- 选择列
- press shift+i
- 按下shift +我
- write your text
- 写下你的文本
- press esc
- 按esc
- press "jj"
- 按“jj”
#1
115
Try this
试试这个
After selecting a block of text, press Shift+i or capital I.
选择文本块后,按Shift+i或大写i。
Lowercase i will not work.
小写的我不工作。
If this doesn't work...
如果这不起作用……
Check if you have +visualextra
enabled in your version of Vim.
检查你的Vim版本是否有+visualextra功能。
You can do this by typing in :ver
and scrolling through the list of features. (You might want to copy and paste it into a buffer and do incremental search because the format is odd.)
您可以输入:ver并在特性列表中滚动。(您可能想要复制粘贴到缓冲区中,并进行增量搜索,因为格式很奇怪)。
Enabling it is outside the scope of this question but I'm sure you can find it somewhere.
启用它不在这个问题的范围之内,但我相信你可以在某个地方找到它。
#2
19
You might also have a use case where you want to delete a block of text and replace it .
您还可能有一个用例,您希望删除一个文本块并替换它。
Like this
像这样
Hello World
Hello World
You can visual block select before "W" and hit I - Type "Cool" - Hit ESC and then delete "World" by visual block selection .
你可以在“W”之前进行视觉区块选择,点击I - Type“Cool”-点击ESC,然后通过视觉区块选择删除“World”。
Alternatively, the cooler way to do it is to just visual block select "World" in both lines. Type c for change
. Now you are in the insert
mode. Insert the stuff you want and hit ESC. Both gets reflected with lesser keystrokes.
另一种更酷的方法是只在两行中选择“World”。c型变化。现在您处于插入模式。插入你想要的东西,点击ESC。这两种方法都可以通过更小的击键来实现。
Hello Cool
Hello Cool
#3
10
- press ctrl and v // start select
- 按ctrl + v /开始选择
- press shift and i // then type in any text
- 按shift键,输入任何文本
- press esc esc // press esc twice
- 按esc // /按esc两次
#4
1
if you want to add new text before or after the selected colum:
如果您想在选定的colum之前或之后添加新文本:
- press ctrl+v
- 按ctrl + v
- select columns
- 选择列
- press shift+i
- 按下shift +我
- write your text
- 写下你的文本
- press esc
- 按esc
- press "jj"
- 按“jj”