Sunday, May 30, 2021

Re: Insert non-rectangular selection

On Do, 27 Mai 2021, Bram Moolenaar wrote:

>
> 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?

Okay done.

>
>
> 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.

Okay, I'll have a look at adding a zy command as well (this will be a
separate PR).

Best,
Christian
--
Wer irgendeine Art von Religion zur Stütze seiner Sittlichkeit bedarf,
dessen Moralität ist nicht rein, denn diese muß ihrer Natur nach in
sich selbst bestehen.
-- Karoline von Günderode

--
--
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/20210530174228.GE1800871%40256bit.org.

No comments:

Post a Comment