Skip to content

Improvements to block-wise visual paste#8289

Closed
chrisbra wants to merge 4 commits intovim:masterfrom
chrisbra:normal_zp_command
Closed

Improvements to block-wise visual paste#8289
chrisbra wants to merge 4 commits intovim:masterfrom
chrisbra:normal_zp_command

Conversation

@chrisbra
Copy link
Member

Blockwise visual paste always pastes a whole complete uniform block. For lines that are shorter, trailing spaces are appended, so that always a uniform x rows by y characters selection will be pasted. However, sometimes it might be desirable to just paste the block without adding trailing spaces.

See e.g. https://vi.stackexchange.com/q/31378/71

So let's allow this using the new z commands zp and zP.

@codecov
Copy link

codecov bot commented May 30, 2021

Codecov Report

Merging #8289 (56243e5) into master (f883d90) will decrease coverage by 0.12%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8289      +/-   ##
==========================================
- Coverage   89.58%   89.46%   -0.13%     
==========================================
  Files         148      148              
  Lines      167042   164293    -2749     
==========================================
- Hits       149650   146982    -2668     
+ Misses      17392    17311      -81     
Flag Coverage Δ
huge-clang-none 91.23% <100.00%> (+2.45%) ⬆️
huge-gcc-none 89.04% <100.00%> (-0.01%) ⬇️
huge-gcc-testgui 87.54% <100.00%> (-0.01%) ⬇️
huge-gcc-unittests 2.50% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/normal.c 96.03% <100.00%> (+<0.01%) ⬆️
src/register.c 91.97% <100.00%> (+0.01%) ⬆️
src/os_unix.c 70.99% <0.00%> (-0.97%) ⬇️
src/if_xcmdsrv.c 88.13% <0.00%> (-0.77%) ⬇️
src/textobject.c 91.69% <0.00%> (-0.71%) ⬇️
src/screen.c 85.80% <0.00%> (-0.64%) ⬇️
src/if_python.c 82.65% <0.00%> (-0.62%) ⬇️
src/bufwrite.c 84.17% <0.00%> (-0.60%) ⬇️
src/drawline.c 84.74% <0.00%> (-0.55%) ⬇️
src/move.c 93.77% <0.00%> (-0.54%) ⬇️
... and 108 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f883d90...56243e5. Read the comment docs.

@brammool brammool closed this in 2fa9384 May 30, 2021
@Shane-XB-Qian

This comment was marked as off-topic.

@Shane-XB-Qian

This comment was marked as off-topic.

@habamax
Copy link
Contributor

habamax commented May 31, 2021

Maybe I do smth wrong too buy I can't get it:

vim-zp

@habamax
Copy link
Contributor

habamax commented May 31, 2021

Okay :set virtualedit=block is the reason for this. Not sure if this is expected or not though.

@chrisbra
Copy link
Member Author

not sure, I'll check

janlazo added a commit to janlazo/neovim that referenced this pull request May 31, 2021
Problem:    Cannot paste a block without adding padding.
Solution:   Add "zp" and "zP" which paste without adding padding. (Christian
            Brabandt, closes vim/vim#8289)
vim/vim@2fa9384

Cherry-pick Test_normal_z_error() from patch v8.2.0369.
@habamax
Copy link
Contributor

habamax commented May 31, 2021

not sure, I'll check

If this would be considered as expected then I guess a mention about virtualedit exception should be added to zp/zP description.

janlazo added a commit to janlazo/neovim that referenced this pull request Jun 1, 2021
Problem:    Cannot paste a block without adding padding.
Solution:   Add "zp" and "zP" which paste without adding padding. (Christian
            Brabandt, closes vim/vim#8289)
vim/vim@2fa9384

Cherry-pick Test_normal_z_error() from patch v8.2.0369.
@chrisbra
Copy link
Member Author

chrisbra commented Jun 1, 2021

I think those spaces come from the yank command already. That's what the zy comand should fix #8292

last-partizan pushed a commit to last-partizan/neovim that referenced this pull request Jun 11, 2021
Problem:    Cannot paste a block without adding padding.
Solution:   Add "zp" and "zP" which paste without adding padding. (Christian
            Brabandt, closes vim/vim#8289)
vim/vim@2fa9384

Cherry-pick Test_normal_z_error() from patch v8.2.0369.
@chrisbra chrisbra deleted the normal_zp_command branch June 22, 2021 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants