How do I quickly jump to any location with two characters?
Answer
s{char}{char} (vim-sneak)
Explanation
vim-sneak provides a motion that lets you jump to any location specified by two characters. It is faster than f because it works across lines.
How it works
s{char}{char}jumps forward to the next occurrence of those two charactersS{char}{char}jumps backward;and,repeat the motion forward and backward
Example
To jump to the word function from anywhere visible, type sfu — this jumps to the first fu in the buffer.
Tips
- Install:
Plug 'justinmk/vim-sneak' - More precise than
fbecause two chars narrow the matches significantly sreplaces the built-inscommand (useclinstead)- Can be configured to highlight all matches like EasyMotion
- Works as a motion with operators:
dsabdeletes to the nextab