Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where exactly yanked text is copied #22

Closed
horseinthesky opened this issue Apr 5, 2021 · 4 comments
Closed

Where exactly yanked text is copied #22

horseinthesky opened this issue Apr 5, 2021 · 4 comments
Assignees

Comments

@horseinthesky
Copy link

Me again :P

Didn't quite get where exactly text from the register is copied when select and copy text from the corresponding " register.

When I open peekup via ""`` I press, for instance, 3 to get a text from the register "3 but palways pastes text from the unnamed register""`.

@gennaro-tedesco
Copy link
Owner

gennaro-tedesco commented Apr 5, 2021

When you select text in the peekup window, the content of the selected register is temporarily copied into the unnamed register that defaults to * (you can change it with lua require('nvim-peekup.config').on_keystroke["paste_reg"] = ... if needed): this is so that the content is made available for pasting in whichever mode you want, in principle.

Alternatively, you can set

let g:peekup_paste_before = '<leader>P'
let g:peekup_paste_after = '<leader>p'

and hitting <leader>p/P will automatically open the window and paste the selected text before/after without storing it into the unnamed register first (and without the user having to p themselves).

What is the problem that you are seeing? Are you unable to select different registers?

@gennaro-tedesco gennaro-tedesco self-assigned this Apr 5, 2021
@horseinthesky
Copy link
Author

With no extra config when I pick a register, let's say 4, it is not copied to *.
image
image
and p always pastes "" register.

I can more or less workaround this by

require('nvim-peekup.config').on_keystroke["paste_reg"] = "\""

but I wonder what is your original idea? Am I doing something wrong?

@gennaro-tedesco
Copy link
Owner

gennaro-tedesco commented Apr 5, 2021

This is probably due to the fact that on your system the default unnamed register is \" instead of *: this is the reason why the configuration is exposed to the user with require('nvim-peekup.config').on_keystroke["paste_reg"] = "\"", so that they can configure it at will. This was added here after a discussion with my collaborator in this issue. We thought this would be the most practical way to make it portable on many architectures:

See below a proof of the behaviour:
Screen-Recording-2021-04-05-at-1

but I wonder what is your original idea?

the idea is simply that if we want the user to have flexibility on how to paste the content selected in the peekup window, such content must be temporarily stored somewhere (for you to access with p or ctrl+v or so) - the most appropriate location is the unnamed register, whichever one it is according to the architecture. If you instead want to directly paste without temporarily storing anything, you can use

let g:peekup_paste_before = '<leader>P'
let g:peekup_paste_after = '<leader>p'

Are you able to copy&paste different registers content after specifying the default unnamed?

@horseinthesky
Copy link
Author

paste before/after works great. Thank you for the explanation.

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

No branches or pull requests

2 participants