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

Added command to copy between registers #9717

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

uek-1
Copy link
Contributor

@uek-1 uek-1 commented Feb 24, 2024

Added a command to copy the contents of the selected register to another. Closes #9552.

@pascalkuthe
Copy link
Member

I wonder if this is quite the right command tough. kacuone has a more generic :set-register typable command. That could be combined with command expansion (where I think being able to expand to registers would be quite useful) to implement the same thing

@uek-1
Copy link
Contributor Author

uek-1 commented Feb 24, 2024

I wonder if this is quite the right command tough. kacuone has a more generic :set-register typable command. That could be combined with command expansion (where I think being able to expand to registers would be quite useful) to implement the same thing

To be clear, one would do this in kakoune by typing :set_register <destination_register> %reg{source_register} right? If so, I think this is super versatile but I think it may be less intuitive than an explicit copy command.

@the-mikedavis
Copy link
Member

I think a :set-register command could also be useful but it might be complicated to use it to copy between registers, for example if you're copying a set of selections from one register to another

@the-mikedavis the-mikedavis added S-waiting-on-review Status: Awaiting review from a maintainer. A-command Area: Commands labels Feb 27, 2024
@pascalkuthe
Copy link
Member

We discussed this briefly: I don't think a typable:copy-register command carrys its weight over :set-register %reg{..} but an interactive version bound to a key that would prompt the user which registers to copy from/to would.be worth adding

Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make this a little more interactive let's show the autoinfo popup for the registers like in select_register:

fn select_register(cx: &mut Context) {
cx.editor.autoinfo = Some(Info::from_registers(&cx.editor.registers));
cx.on_next_key(move |cx, event| {
if let Some(ch) = event.char() {
cx.editor.autoinfo = None;
cx.editor.selected_register = Some(ch);
}
})
}

and prompt for both register with two on_next_key callbacks

@the-mikedavis the-mikedavis added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from a maintainer. labels Feb 27, 2024
@kirawi
Copy link
Member

kirawi commented Apr 17, 2024

Should we close #7494 in favor of this?

@pascalkuthe
Copy link
Member

Should we close #7494 in favor of this?

No we want both set-register so you can combine it with commands expansion (and use it in keymaps) and an interactive command to copy between registers.

@kirawi kirawi added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-command Area: Commands S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add command to copy values between registers
4 participants