Thursday, May 27, 2021

Re: Insert non-rectangular selection

Christian wrote:

> On Di, 25 Mai 2021, Andre Tann wrote:
>
> > Hi all,
> >
> > I repeatedly have the following situation, and wonder how it can be handled
> > better than I do it now. These lines must be merged
> >
> > /path/subdir ;text
> > /path/longsubdir ;text
> > /path/longlongsubdir;text
> >
> > with these:
> >
> > /subdir
> > /longsubdir
> > /longlongsubdir
> >
> > Result:
> >
> > /path/subdir;text
> > /path/longsubdir;text
> > /path/longlongsubdir;text
> >
> >
> > What I do now is to mark and yank the second block, go to the first
> > semicolon, and press P. Result is:
> >
> > /path/subdir ;text
> > /path/longsubdir ;text
> > /path/longlongsubdir;text
> >
> > But this is obviously not what I want. How can I avoid the extra blanks?
>
> I have this annoyance a few times as well. I would go with the already
> mentioned `:s` approach to remove the whitespace, afterwards. However, I
> was wondering, if we not could do any better any perhaps have something
> like a `zp` command, that does not add any trailing spaces.

This makes a lot of sense. I don't see a problem using "zp" and "zP"
for this.

Can you turn this into a pull request and add a test?


The example yanks until the end of the line, thus the register does not
contain trailing spaces. I wonder what to do when yanking halfway a
line, e.g. a column in a table:

texttext /subdir columntext
texttext /longsubdir columntext
texttext /longlongsubdir columntext

Here you can only yank a block including the spaces, and they would also
be inserted with "zp". Perhaps we should also have a "zy" command to
exclude the trailing spaces when yanking. I think that's better than
having "zp" drop spaces that were yanked.


--
5 out of 4 people have trouble with fractions.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/202105271129.14RBT7BW958367%40masaka.moolenaar.net.

No comments:

Post a Comment