vim repeat find next character 'x'

Time has passed since I asked this question - nowadays I use vim-easymotion, which makes the need for ; almost unnecessary.

This plugin allows to jump to a certain letter directly - triggering the plugin makes all letters grey except for all 'x' on the screen - and those are replaced by red letters which you can press to jump directly to it.

easymotion in use


The command to repeat an f is ; (semicolon); , (comma) reverses the direction of the search.


To add to @Jeremiah Willcock answer, We can add count to f command to go to the nth occurrence [count]f{char}. For e.g.

2fx => goes to the second occurrence of x [if available]

similarly we can use the same counter to ; and ,. For e.g.

2; => goes to the second occurrence of last search [if available]
2, => goes to the second occurrence of last search in reverse [if available]

This is very useful when using it with c{motion}(change) or d{motion}(delete). For e.g.
If we want to change or delete to 3rd occurrence of a char we can do

c3fx => change to 3rd occurrence of character x (included)
d3fx => delete to 3rd occurrence of character x (included)

Tags:

Vim

Repeat