user1889034
user1889034

Reputation: 343

Is there a variant of f in vim to only match the first character in a word?

I'm editing prose in vim, and f is a quick way to move, but it would be quicker still if I could limit f to matching initial characters. I know about w and e, and I use those, too, but they aren't great for long lines.

Upvotes: 0

Views: 68

Answers (1)

FDinoff
FDinoff

Reputation: 31419

You could always just use normal searching.

/\<f

Would search from the current to the next word that starts with f. If you wanted to you could make a mapping for it using getchar(). An example of this would be

:nnoremap <expr> <f2> '/\<' . nr2char(getchar()) . '<CR>'

Which would map <f2><char> to jump to the next inputed char.

Upvotes: 4

Related Questions