Motion to last character

故事扮演 提交于 2019-12-06 02:13:55

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!