Jeff
Jeff

Reputation: 12418

How to jump to a specific character in vim?

How can I jump to the next character X in vim?

I frequently use, e.g., dt: or ct: to delete/change everything up until a colon (or some other character).

Is there any short key combo to simply move my cursor position to that character?

Upvotes: 234

Views: 112275

Answers (4)

Philia Fan
Philia Fan

Reputation: 4498

Maybe you are just searching for a pure vim combination but EasyMotion is a plugin that worth trying. HTH. :)

Upvotes: 3

Alexander Corwin
Alexander Corwin

Reputation: 1157

If you do a search for that character with /, you can then hit n to move to the next occurrence of it.

Upvotes: 14

Brian Rasmussen
Brian Rasmussen

Reputation: 116401

t and f work without a command as well, so to move to colon use f: and to move to right before colon use t:

Upvotes: 81

Lars Kotthoff
Lars Kotthoff

Reputation: 109232

You can type f<character> to put the cursor on the next character and F<character> for the previous one.

Upvotes: 427

Related Questions