On Tuesday, November 19, 2013 4:42:32 PM UTC-5, Bram Moolenaar wrote:
> Daniel Thau wrote:
>
>
>
> > Attached is a patch (in both the unified and context formats) to make
>
> > the discussed "am/im" text-object.
>
>
>
> > *** a/runtime/doc/motion.txt
>
> > --- b/runtime/doc/motion.txt
>
> > ***************
>
> > *** 662,667 **** i` *v_i`*
> > *i`*
>
> > --- 662,687 ----
>
> > Special case: With a count of 2 the quotes are
>
> > included, but no extra white space as with a"/a'/a`.
>
> >
>
> > + am{char} *v_am* *am*
>
> > + "a matched {char}". Selects the text from the
>
> > + previous {char} until the next {char}.
>
> > + Only works within one line.
>
> > + When the cursor starts on a {char}, Vim will figure
>
> > + out which {char} pairs are desired by searching from
>
> > + the start of the line.
>
> > + Any trailing white space is included, unless there is
>
> > + none, then leading white space is included.
>
> > + When used in Visual mode it is made characterwise.
>
> > + Repeating this object in Visual mode another
>
> > + {char}..{char} range is included. A count is
>
> > + currently not used.
>
> > +
>
> > + im{char} *v_im* *im*
>
> > + Like am{char} but exclude the {char} and
>
> > + repeating won't extend the Visual selection.
>
> > + Special case: With a count of 2 the quotes are
>
> > + included, but no extra white space as with am{char}.
>
> > +
>
>
>
> I'm sure users will ask about a multi-line implementation. This
>
> requires defining how Vim decides whether a matching {char} is the start
>
> or the end, but otherwise it should work.
I can experiment with adding multi-line to the new im/am object. Perhaps make
another function for it instead of piggypacking off the quote funciton. I'll
play with having the matching {char} at the beginning and at the end and see if
either feels more natural. However, that raises additional questions; there's
a number of ways of going about it.
- Should the quote objects also do multiline (after all their currently valid
uses), or should they continue to do what they are doing and only have the new
m-quote objects do multi-line?
- Should the m objects (including m-quote) seek ahead in the same line the way
normal quotes do before checking for multi-line, or should they immediately
check multiline and not do the seek-ahead-on-the-same-line thing that the
normal quote objects do?
I'm inclined to have normal quote objects do what they've always done, and have
the new m objects always go multi-line and not search same-line.
Consider a buffer like so:
foo bar "
baz " qux "
With the cursor on the "z" in baz. The way I am invisioning this, vi" will
select the quz and vim" will select the baz. The other im/am objects will
similarly just do multi-line and not worry about seeking ahead on the same line.
If there's any disagreement with the way I'm leaning on this I'm more than
happy to go about it any other way.
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.