3

I have to do a lot of hopping in lines.

Often times I want to hop to a t in a line, and promptly press ft, only to discover that I have to do it 7 times before I can actually make it to my destination.

I'm trying to think of ways to eliminate this time waster. Is there a way to find a bigram instead, so fts would hop to ts in a line?

3
  • how about using /ts<CR> it will be four keys instead of three...
    – Sundeep
    Commented Apr 20, 2017 at 4:32
  • 2
    I use easymotion too for that problem, but i just wanted to hint, you can repeat the f command with ;. And also use a count for that, for example, you press ft, then see that you have do do 6 more jumps, you can press 6;
    – B.G.
    Commented Apr 20, 2017 at 6:18
  • @DoktorOSwaldo ; for me was remapped to :. Perhaps its time to remap that.
    – Anon
    Commented Apr 20, 2017 at 22:50

3 Answers 3

5

The sneak plugin provides that functionality.

By default, it's bound to the s key, so you would need to use sts for your example. The documentation also gives example mappings to put sneak's functionality on the f family of keys or to enhance the standard 1-character searches with some of sneak's other improvements.

3

The easymotion plugin also provides functionality like that. Easymotion is considered to be larger with more features, both come highly recommended. Maybe someone needs to write a review of both, while checking them out...

3
  • Sneak & Easymotion have a quite different principle. Sneak only provides an 'improved' version of f with two instead of 1 characters. While easymotion highlights every occurence and let you jump directly with enumerations. Easymotion has this functionality also for search, and can even search and jump over multiple splits. But Sneak is more flexible, allowing you to use it in a normal command chaining. F. E. d2<sneak>ts is perfectly fine while d2<easymotion>ts won't work. Also sneak is repeatable with ;. (Feel free to correct me, if it is also possible with easymotion)
    – B.G.
    Commented Apr 21, 2017 at 6:02
  • esaymotion does have bigram movements like sneak, movements are also repeatable, but use the . instead of ;. Which one is "right" or "better" is of course a matter of debate.
    – mike
    Commented Apr 22, 2017 at 7:16
  • Do you mean, easymotion has a bigram movement, which like sneak does automatically select the first match ? I only know of the easymotion-overwin-f2 function, which enumerates all matches. Also can't repeat the easymotion-overwin-f2 function with . what am I missing ?
    – B.G.
    Commented Apr 24, 2017 at 5:42
3

Besides the plugins mentions, there are several other plugins available, that extend the f and t motions. Among there are clever-f, vim-fanfingtastic and my own ft-improved.

At least for my plugin I can tell you, that you can configure it, to check for several following characters. You have to set :let g:ft_improved_multichars = 1 in your vimrc for that.

Also you might be interested in this similar question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.