I have a line which contains the following text:

'some text in the quotation mark' some other text goes here
       cursor is here

What is the fastest way to replace the text within a quotation mark with something else? I mean I want to type something completely different there. Is there a shortcut to remove all text within the quotation and enter to insert mode?

  • 5
    What's wrong with ci' ?!!! – dNitro Sep 25 '16 at 11:56

You need to use c operator, followed by the i' text-object:


This will turn:

'some text in the quotation mark' some other text goes here


'foo' some other text goes here

:h navigation will blow your mind.

  • 1
    After you learn the text-objects/motions/operators available by default in Vim, you may want to look at some extra ones, e.g. targets, providing additional features, or the one Sato Katsura suggested in the now deleted answer (textobj-quotes). – VanLaser Sep 25 '16 at 18:46
  • @VanLaser, or read up on :omap which lets you create your own text-objects without third party tools and libraries before going plugin crazy. – romainl Sep 25 '16 at 19:02
  • @romainl, not or, and :P – VanLaser Sep 25 '16 at 19:14
  • 1
    ... Because once you read about :omap your first attempts at creating text objects are guaranteed to outshine a library written by the likes of Kana Natsuno. Well played Romain, well played. – lcd047 Sep 25 '16 at 21:44
  • Yes, mister plugin developper, there's infinitely more value in customizing Vim than your kind would care to admit. Not everything needs to be generic, bloated, opaque, and over-engineered to be useful. Vim's ecosystem is nice and all but Vim itself is what powers your crappy useless product that nobody actually needs. – romainl Sep 26 '16 at 5:45

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.