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?
You can type f<character>
to put the cursor on the next character and F<character>
for the previous one.
;
to repeat the operation and use ,
to repeat it in opposite direction.
/<character>
to match it anywhere.
Commented
Mar 25, 2016 at 18:18
,
, sometimes I get overzealous and jump past and never knew I could go back.
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:
fSYMBOL
, if you want to edit text after the colon you can use f:a
If you do a search for that character with /
, you can then hit n
to move to the next occurrence of it.
:set invhls
which is useful for toggling the highlights off and on (I map this to a shortcut for quick toggling).
Commented
Apr 4, 2019 at 14:34
Maybe you are just searching for a pure vim combination but EasyMotion is a plugin that worth trying. HTH. :)
T
will jump to after the first sought character to the left, and I can confirm that the;
and,
repeaters work with all off
/F
/t
/T
.