4

I can use f or F to highlight/change or jump to the next occurrence of say, a comma.

This is way useful, but is there a way to highlight/change to the character just before?


Say I have some code:

this.remove (object, index + 1, name)
                     ^ cursor

and want to replace the index + 1 with location? cf, will require me to retype the comma location, in my replacement text.


Is there a command already to do this, or how would I go about adding this to my Vim?

8

You should have scrolled a bit when you read :help f:

ct,
cT,

See :help t.

| improve this answer | |
  • 1
    Another great shortcut I've found is ; repeats the last f F t T command used. – Robbie Wxyz Oct 13 '15 at 0:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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