Skip to content

Conversation

tyru
Copy link

@tyru tyru commented Jan 20, 2016

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]:")

Support 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

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

 ## End Pos

Search for...

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

Word character before

2\. `[:space:]` (`"foo_bar_ba[z]  "`)
3\. `$` (`"foo_bar_ba[z]"`)
4\. `\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]:"`)
@khughitt
Copy link

Tested this and it works great for me! Thanks @tyru 👍

@bobrippling
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants