问题
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
回答1:
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.
回答2:
$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.
回答3:
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
回答4:
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.
回答5:
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
.
来源:https://stackoverflow.com/questions/19356598/motion-to-last-character