The difference between “find” and “till” in vim

keyboard shortcutsvivim

I see I can use t c or Tc to move to the next / previous character c

I can also use fc or Fc to move to the next / previous character c

Is the only difference between them that tc places the cursor before the character, Tc (going backwards) places the cursor after the character and fc / Fc both place it on the character itself?

Best Answer

The only different between them is cursor position. From :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.
Related Question