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

Select the data inserted by the p and P primitives #4277

Closed
lenormf opened this issue Jul 23, 2021 · 6 comments
Closed

Select the data inserted by the p and P primitives #4277

lenormf opened this issue Jul 23, 2021 · 6 comments

Comments

@lenormf
Copy link
Contributor

lenormf commented Jul 23, 2021

Related to #1468

Feature

It'd be nice to have data arbitrarily inserted into the buffer via pasting be selected upon insertion.

Usecase

That feature would simplify the process of inserting data into a buffer that subsequently needs to be modified, especially when dealing with multiple line insertions (e.g. pasting from the clipboard).

This would probably have implications that are not necessarily comfortable to deal with interactively, I haven't thought much about it (better try it on a test branch and see how that goes).

HTH.

@lenormf lenormf changed the title Select the data inserted by the p and <a-p> primitives Select the data inserted by the p and P primitives Jul 23, 2021
@krobelus
Copy link
Contributor

How is this different from <a-p>? I guess because p just pastes one value from the given register.

@eraserhd
Copy link
Contributor

I think this would be a big win. IMHO, the selection information is currently effectively "lost" and has to be recreated.

  1. Most times when I paste, it is followed immediately by j or k, or maybe some number and g.
  2. pi has the same effect. pa seems more predictable.
  3. p; isn't hard in cases where it is wanted. p<a-;>; well, is hard, but I don't think it would be used frequently.

@ctem
Copy link

ctem commented Jul 26, 2021

In the meantime, since redo results in selection, how about abusing it for a funny workaround like map global normal p 'puU'?

@Calum-J-I
Copy link
Contributor

A possible implementation would be to add undo groups as a text object. The object would be defined by the start and end of the changed region(s) (for Type::Erase this would a single character). Counts would specify how far back in the history. You could then

map normal p 'pl<a-a>h'
map normal ! '!l<a-a>h'

where h stands for history since u is already taken.

@Delapouite
Copy link
Contributor

A new experimental branch has been started on the topic: 6e81879

@occivink
Copy link
Contributor

This can now be closed

@mawww mawww closed this as completed Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants