How do I repeat the last f/t/F/T motion in the opposite direction?
Answer
,
Explanation
After using f, t, F, or T for single-character motion on a line, Vim lets you repeat that character search without retyping the target. Most users know ; repeats in the same direction. The less-used companion is ,, which repeats the same character search in the opposite direction. This makes local line navigation much faster in dense code.
How it works
f{char}andt{char}search forward on the current lineF{char}andT{char}search backward on the current line;repeats the previous find in the same direction,repeats it in the opposite direction
Because , reuses the last find target, it is ideal for bouncing between nearby delimiters or arguments while staying in Normal mode.
Example
Given:
call(first_arg, second_arg, third_arg)
Place the cursor near the start and press:
f,
Now ; jumps to the next comma, while , jumps back to the previous comma.
Tips
- Use counts with repeats, e.g.
2;or2, - This works with
t/Tmotions too, not justf/F - Great for quick edits inside long argument lists without invoking search mode