i 和 a 在所有视图模式下不像正常模式那样工作的原因是它们被用于扩展选择到文本对象。如您在:help visual-operators中所看到的:
4. Operating on the Visual area
The operators that can be used are:
~ switch case
d delete
c change (4)
y yank
> shift right (4)
< shift left (4)
! filter through external command (1)
= filter through 'equalprg' option command (1)
gq format lines to 'textwidth' length (1)
The objects that can be used are:
aw a word (with white space)
iw inner word
aW a WORD (with white space)
iW inner WORD
as a sentence (with white space)
is inner sentence
ap a paragraph (with white space)
ip inner paragraph
ab a () block (with parenthesis)
ib inner () block
aB a {} block (with braces)
iB inner {} block
at a <tag> </tag> block (with tags)
it inner <tag> </tag> block
a< a <> block (with <>)
i< inner <> block
a[ a [] block (with [])
i[ inner [] block
a" a double quoted string (with quotes)
i" inner double quoted string
a' a single quoted string (with quotes)
i' inner simple quoted string
a` a string in backticks (with backticks)
i` inner string in backticks
Additionally the following commands can be used:
: start Ex command for highlighted lines (1)
r change (4)
s change
C change (2)(4)
S change (2)
R change (2)
x delete
D delete (3)
X delete (2)
Y yank (2)
p put
J join (1)
U make uppercase
u make lowercase
^] find tag
I block insert
A block append
所以在可视块模式下,只需使用大写的I进行块插入
或使用大写的A进行块追加
。
i
命令在光标位置之前插入内容。在可视块模式下,光标位置(通常)代表选择的右下角,并且光标位置包括在块中。i
的语义不匹配,这就是为什么Vim实现中没有它的原因(将其添加可能只需要一行简单的源代码更改)。对于I
(在任何文本之前插入)和A
(在任何文本之后插入),它们的语义确实匹配,这就是为什么在可视块模式下它们是可用的。