vim-textobj-underscore icon indicating copy to clipboard operation
vim-textobj-underscore copied to clipboard

Supported word character before/after [:space:], ^ or $, \W

Open tyru opened this issue 9 years ago • 2 comments

Sorry, almost implementation were rewritten. However, I thought I should send a pull request because I hope this saves existing vim-textobj-underscore users too :)

Supported 3 extra cases.

  • a_ Keymapping
    1. " [foo_]bar_baz"
    2. "[foo_]bar_baz"
    3. ":[smile]:"
  • i_ Keymapping
    1. " [foo]_bar_baz"
    2. "[foo]_bar_baz"
    3. ":[smile]:"

and if no matching text-object is found, both i_ and a_ select nothing (functions return 0).

a_ Keymapping

Start Pos

Search for...

  1. _ ("foo[_]bar[_]baz")
  • This is a supported character currently.

Word character after

  1. [:space:] (" [f]oo_bar_baz")
  2. ^ ("[f]oo_bar_baz")
  3. \W (":[s]mile:")

End Pos

Search for...

  1. _ ("foo[_]bar[_]baz")
  • This is a supported character currently.

Word character before

  1. [:space:] ("foo_bar_ba[z] ")
  2. $ ("foo_bar_ba[z]")
  3. \W (":smil[e]:")

i_ Keymapping

Start Pos

Word character after

  1. _ ("foo_[b]ar_[b]az")
    • This is a supported character currently.
  2. [:space:] (" [f]oo_bar_baz")
  3. ^ ("[f]oo_bar_baz")
  4. \W (":[s]mile:")

End Pos

Word character before

  1. _ ("fo[o]_ba[r]_baz")
    • This is a supported character currently.
  2. [:space:] ("foo_bar_ba[z] ")
  3. $ ("foo_bar_ba[z]")
  4. \W (":smil[e]:")

tyru avatar Jan 20 '16 16:01 tyru

Tested this and it works great for me! Thanks @tyru :+1:

khughitt avatar Sep 23 '19 16:09 khughitt

Agreed, this covers missing functionality for me too, thanks @tyru

bobrippling avatar Oct 22 '21 19:10 bobrippling