My JumpToLastOccurrence plugin extends the built-in f
/ F
/ t
/ T
motions with counterparts (by default bound to ,f
etc.) that move to the last occurrence of {char}
in the line.
Question
Is there a motion to move to the last of a character?
Example:
[A]pple -> move to last p -> Ap[p]le
I can do that with 2fp
but if there's lots of "p"s in the line then it's not so easy to count them then do 10fp
Solution 2
OTHER TIPS
$Fp
$
jumps to the end of the line, F
jumps backwards to the character p
.
This does not work if p
is your last character.
Search from the end
Instead of looking for the last occurrence of a character - move to the end and look backwards for the first:
$Fp
There's no such motion.
But you could always do vfp;;;;d
or v$Fpd
.
Or find another more suitable target.
Or use a plugin like Easymotion.
My Vim plugin improved_ft also allows for this. Set let g:ft_improved_multichars = 1
, press f
and then type p
followed by l
.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow