New zy command: Yank without trailing whitespace#8292
New zy command: Yank without trailing whitespace#8292chrisbra wants to merge 4 commits intovim:masterfrom
Conversation
5de2955 to
6bbec6a
Compare
Codecov Report
@@ Coverage Diff @@
## master #8292 +/- ##
==========================================
- Coverage 89.58% 87.73% -1.86%
==========================================
Files 148 148
Lines 167049 163420 -3629
==========================================
- Hits 149659 143376 -6283
- Misses 17390 20044 +2654
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
As someone noticed, doing the same when deleting text, which is basically yanking the text first, "zd" cannot be used, it is an existing command. But perhaps that is OK, since when deleting the text you would still want the whole block to be deleted, only the yanking would omit the trailing spaces. So it could be a three step operation:
Still, that requires typing three commands. I don't see an obvious two-letter command we could use for this. |
|
oh, where did my test go? |
|
looks like test failures are unrelated. |
This comment was marked as off-topic.
This comment was marked as off-topic.
|
There are 2 different use cases: Take a block like this: You can block select this You have a whitespace-delimited block like this: Now, if you visual select column 2 using This can be prevented by using the This case also happens for example 1, when you have
I think the user knows what he actually wants so can decide depending on his actual requirements, so this is okay.
As shown, there are difference use cases, that each command covers, so a |
This comment was marked as off-topic.
This comment was marked as off-topic.
Problem: Cannot yank a block without trailing spaces. Solution: Add the "zy" command. (Christian Brabandt, closes vim/vim#8292) vim/vim@544a38e
Problem: Cannot yank a block without trailing spaces. Solution: Add the "zy" command. (Christian Brabandt, closes vim/vim#8292) vim/vim@544a38e
So with 2fa9384 we can now paste without adding trailing whitespaces.
So let's add an new command 'zy' to yank text, but leave trailing whitespace out. This allows to yank whitespace delimited text like in a visual table:
column column2 col3
text /dir trailing text
text /longer/dir/here trailing text
text /even/longer/dir/here trailing text
So you can now block select using
Ctrl-Vthe second column and usezyto only copy the non-whitespace characters as a new block.This makes it easier to paste them later using e.g.
zp.Add a test and documentation to it.