How do I repeat or reverse inline character search with f, t, ; and , in Vim?
Answer
f{char} ; ,
Explanation
The f, F, t, and T motions search for a character on the current line. Combined with ; (repeat forward) and , (repeat backward), they become one of the fastest ways to navigate within a line — especially for jumping to specific punctuation or delimiters.
How it works
f{char}— move to next occurrence of{char}on the lineF{char}— move to previous occurrencet{char}— move to just before the next occurrence ("till")T{char}— move to just after the previous occurrence;— repeat the last f/F/t/T in the same direction,— repeat in the opposite direction
Example
Line: def calculate(price, tax, discount):
Cursor at 'd':
f( → jumps to '('
f, → jumps to first ','
; → jumps to second ','
, → jumps back to first ','
Tips
- Use with operators:
dt)deletes everything until),cf,changes up to and including, fandtare case-sensitive by default- For multi-line f/t, consider plugins like
leap.nvimorvim-sneak - Count prefix works:
3f,jumps to the 3rd comma