vimの「find」と「till」の違いは何ですか?

vimの「find」と「till」の違いは何ですか?

t cまたはを使ってTc次/前の文字に移動できることがわかりました。c

fcまたはを使用して、Fc次/前の文字に移動することもできます。c

これらの間の唯一の違いは、tcカーソルを文字の前に置きTc(後ろに)、カーソルを文字の前に置くことです。後ろにキャラクターとfcそのFc両方をキャラクター自体に配置しますか?

ベストアンサー1

これらの間の唯一の違いはカーソル位置です。から: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.

おすすめ記事