为什么小写 [i] 在可视块模式下不起作用?

Why lowercase [i] does not work in visual block mode?

我经常忘记如何在可视块模式下插入并重新阅读the answer Shift+i

正如 Honghe.Wu 在他的评论中想知道的那样:

Why lowercase i does not work in visual mode?

技术原因是什么?

i命令在光标位置前插入。在可视块模式下,光标位置(通常)表示选择的右下角,并且光标位置包含在块中。

因此,i 的语义不匹配,这就是它被排除在 Vim 实现之外的原因(添加它可能是对源代码的简单一行更改代码)。语义匹配I(在任何文本之前插入)和A(在任何文本之后插入),即为什么这些在可视块模式下可用。

因为 ia 在所有视觉模式下都不像正常模式那样表现的原因是 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                    

所以只需在可视块中使用block insert大写Iblock append大写A命令模式。