Vim

vim中的“find”和“till”有什麼區別?

  • January 8, 2015

我看到我可以使用t corT``c移動到下一個/上一個字元c

我也可以使用f``cF``c移動到下一個/上一個字元c

它們之間的唯一區別是t``c將游標放在字元之前,T``c(向後)將游標放在字元之後f``c/F``c都將游標放在字元本身上嗎?

它們之間的唯一區別是游標位置。來自:help motion.txt

                                                 f
f{char}             To [count]'th occurrence of {char} to the right. The                                                         
                   cursor is placed on {char} inclusive.                                                                         
                   {char} can be entered as a digraph digraph-arg.                                                               
                   When 'encoding' is set to Unicode, composing                                                                  
                   characters may be used, see utf-8-char-arg.                                                                   
                   :lmap mappings apply to {char}.  The CTRL-^ command                                                           
                   in Insert mode can be used to switch this on/off                                                              
                   i_CTRL-^.                                                                                                     

                                                  F                                                                             
F{char}             To the [count]'th occurrence of {char} to the left.                                                           
                   The cursor is placed on {char} exclusive.                                                                     
                   {char} can be entered like with the f command.                                                                

                                                  t                                                                             
t{char}             Till before [count]'th occurrence of {char} to the                                                            
                   right.  The cursor is placed on the character left of                                                         
                   {char} inclusive.                                                                                             
                   {char} can be entered like with the f command.                                                                

                                                  T                                                                             
T{char}             Till after [count]'th occurrence of {char} to the                                                             
                   left.  The cursor is placed on the character right of                                                         
                   {char} exclusive.                                                                                             
                   {char} can be entered like with the f command.

引用自:https://unix.stackexchange.com/questions/146824