4

How can I specify a direction (for going backwards) for commands working on text objects like 2caw? E.g. I like to make 2caw replace bbb ccc in aaa bbb ccc ddd while on c.

  • 5
    You don't ... You go back one word, and change forward from there: ge2caw (also b or 2b instead of ge, depending on which c the cursor initially is - ge is safer). – VanLaser Feb 20 '16 at 10:20
  • Ok, so text object selection only works forwards. Thanks! – Stefan Podkowinski Feb 20 '16 at 11:21
  • 5
    There are plugins (e.g. github.com/wellle/targets.vim) that work on objects "behind" or "after" the cursor ( last or next text-object), but I don't know about one that does what you are asking. – VanLaser Feb 20 '16 at 11:31

Your Answer

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

Browse other questions tagged or ask your own question.