amVim-for-VSCode icon indicating copy to clipboard operation
amVim-for-VSCode copied to clipboard

Support for Text Objects

Open techniq opened this issue 8 years ago • 9 comments

I'm creating an issue to track this feature. See Text objects (only in Visual mode or after an operator) in issue #1

These are a few of my commonly used ones:

  • ciw - change in word
  • viw - visual select in word
    • I typically use this followed with yank and paste
  • ci( or ci) - change in parens
    • Useful to change function arguments or if/switch conditions, etc
  • ci< or ci> - change in angle brackets
    • Useful to change html, for example, change <div> to <span>
  • cit - change in tag
    • Example <p>Some | text</p>: If cursor is l, ciw will replace Some text inside <p></p>

techniq avatar Jan 08 '16 13:01 techniq

Support text objects needs some refactoring. I'll get to this one later.

aioutecism avatar Jan 09 '16 01:01 aioutecism

Desperately want this. I'll name my first born after you if you do it.

Raynes avatar Jan 09 '16 09:01 Raynes

Don't foget:

  • ctX - change till X, moves forward
  • cTX - change till X, moves backward
  • cfX - change till X (including X), moves forward
  • cFX - change till X (including X), moves backward

Beatusvir avatar Jan 11 '16 19:01 Beatusvir

Parts of text objects are supported in 1.3.1. See #1 - "Text objects (only in Visual mode or after an operator)" for detail.

aioutecism avatar Apr 23 '16 01:04 aioutecism

@Beatusvir "Till" is not a "text object" and is supported several versions before.

aioutecism avatar Apr 23 '16 02:04 aioutecism

Just want to say thanks for the partial support for text objects, the stuff that is in there seems to work well.

I'll add another vote for the visual select stuff which is still missing like viB, vi(, etc. Useful for confirming the operation in some situations instead of going straight ahead with c or d.

gentius avatar Apr 23 '16 19:04 gentius

@gentius Yes, visual mode support and word/sentence/paragraph support is missing now. Going to add them soon.

aioutecism avatar Apr 23 '16 22:04 aioutecism

I like to use vip and vap which prevents me from using this particular extension.

skube avatar Apr 05 '19 11:04 skube

Version 1.31.0 has just been released today which enables tag-style text objects (cit, dit etc). Please give it a test run and let us know how it works for you.

alisonatwork avatar May 21 '20 13:05 alisonatwork