Open chaoren opened 8 years ago
Whoops, accidentally duplicated with https://github.com/qstrahl/vim-dentures/issues/1, but I spent so much time on the examples...
I'll close #1 in favour of this one, since you put so much effort into it and @tommcdo is a ninny.
:(
@qstrahl any chance this plugin will be extended so that a visual selection can grow?
@kiryph I've always planned to fix it, but I haven't found the time - plus, thinking about these text objects for very long makes my head spin. :P
I would happily welcome a patch... otherwise I'm afraid you're stuck on my "when I feel like it" schedule.
@qstrahl Thanks for the quick feedback.
I guess I picked the wrong time of the year to ping someone to hope to get him to add a great missing feature 😇.
I am actually using https://github.com/michaeljsmith/vim-indent-object which can grow a visual selection. However, I've always been unsure what the best definition for a text object for indentation should be.
The definition of michaeljsmith/vim-indent-object
is:
<count>ai (A)n (I)ndentation level and one line above.
<count>ii (I)nner (I)ndentation level (no line above).
<count>aI (A)n (I)ndentation level and one line above and one below.
<count>iI (I)nner (I)ndentation level (no lines above/below).
I am not unhappy with it, but e.g. vai
to select a python method with decorators does not select the decorator which makes me feel like ai
is not flexible enough:
class Parrot:
def __init__(self):
self._voltage = 100000
@property
def voltage(self):
"""Get the current voltage."""
return self._voltage
I think your definition based on optionally including blank lines could be a more flexible approach. I could imagine something like iIii
with your plugin.
Let
( )
denote the cursor position and[ ]
denote visual selection.Consider this behavior of word objects:
By analogy, your plugin should behave like this: