How do I repeat the last f, t, F, or T character search on a line?
Answer
; / ,
Explanation
After using f, t, F, or T to jump to a character on the current line, pressing ; repeats the same search in the same direction, and , repeats it in the opposite direction. This turns single-character searches into a rapid-fire navigation system — jump to the first match, then tap ; to hop to each subsequent one.
How it works
f{char}moves the cursor forward to the next occurrence of{char}on the current linet{char}moves forward to just before the next{char}F{char}andT{char}do the same but search backward;repeats the lastf/t/F/Tmotion in the original direction,repeats it in the reverse direction- Both
;and,stay on the current line — they never wrap to other lines
Example
Given the text with the cursor at the beginning:
foo, bar, baz, qux, quux
Press f, to jump to the first comma. Now:
- Press
;to jump to the second comma - Press
;again to jump to the third comma - Press
,to jump back to the second comma
This works identically with t: press t, to land just before the first comma, then ; to land just before the second, and so on.
Tips
- Pair
;with the dot command for blazing-fast edits:f,xdeletes a comma, then;.finds the next comma and deletes it too — repeat;.as many times as needed - The
;and,keys remember whether you usedfort, forward or backward — so afterFa, pressing;searches backward for the nextaand,searches forward - Use
df;(delete-find-semicolon) to delete up to and including a character, then;to find the next one and.to delete to it as well - In operator-pending mode,
f/tcombined with;can extend the reach:d2f,deletes through the second comma, butdf,thend;achieves a similar result in two repeatable steps - If you remap
;and,to something else, you lose this repeat functionality — consider this before reassigning these keys - Some users map
;to:for faster command-line access — if you do this, remap the repeat-find to another key so you don't lose it - The
f/trepeat state is global — usingfortfor a new character replaces the previous one, so;always repeats the most recent character search