wellle / targets.vim

Vim plugin that provides additional text objects
MIT License
2.57k stars 55 forks source link

Ignore certain delimiter occurences between pairs #246

Open frangio opened 4 years ago

frangio commented 4 years ago

In Rust, lists of generic parameters are delimited by < >. Items in the list can contain the symbol ->, as in:

struct Foo<A, Fn(A) -> bool> { ... }

I would like to be able to use the < pair text object here (e.g., run da<), but it doesn't work well since > in -> is seen as a delimiter.

Would it be possible to configure targets.vim to ignore the -> symbol? The quote text objects have backslash escaping so I imagine it has to be possible to do something similar.

As a bonus, it would be awesome to be able to properly use argument text objects within those angle brackets too.

wellle commented 4 years ago

Hey, thanks for the issue. I believe currently we use the builtin Vim text object a< for this, which appears to have the same issue. So it seems like we'd need to switch to a different internal implementation to find matching angle brackets in order to allow such behavior. I might do look into that at some point, but I will probably not find time for that in the near future.