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 ! and <a-!> primitives #1468

Closed
lenormf opened this issue Jun 26, 2017 · 3 comments
Closed

Select the data inserted by the ! and <a-!> primitives #1468

lenormf opened this issue Jun 26, 2017 · 3 comments

Comments

@lenormf
Copy link
Contributor

lenormf commented Jun 26, 2017

Hi,

It would be convenient to have the text inserted by the ! and <a-!> primitives automatically selected after they've been added to the buffer.

Thanks.

@Delapouite
Copy link
Contributor

Yes. And I think this approach could be generalized.

Current situation:

  • p and P inserts/appends the content of a register but keeps the selection
  • <a-p> and <a-P> inserts/appends every yanked selections and select each pasted string
  • ! and <a-!> inserts/appends a shell command output

Notice that only <a-p>/<a-P> have the behavior of selecting what's been inserted. It does 2 things.

As lenormf request in this issue, this "insert AND select inserted" behavior could be useful for ! and <a-!>, but I'll argue that it can sometimes also be useful for regular p and P as well.

So I think we should be consistent everywhere:

  • make <a-p> and <a-P> only insert/append.
  • offer an easy way to select what's just been inserted if desired.

Potential suggestion could be to store a %val{inserted_selections_desc} that is refreshed everytime one of the p or ! commands above are triggered. This way the user could add a map in his kakrc:

map global user s ':select %val{inserted_selections_desc}`

Code wise I think it should be possible because the third param of selection.insert() already provides the inserted selections like in the paste_all funcition: https://github.com/mawww/kakoune/blob/master/src/normal.cc#L701

lenormf added a commit to lenormf/kakoune that referenced this issue Jun 30, 2018
lenormf added a commit to lenormf/kakoune that referenced this issue Nov 17, 2018
lenormf added a commit to lenormf/kakoune that referenced this issue Nov 17, 2018
lenormf added a commit to lenormf/kakoune that referenced this issue Nov 17, 2018
@Delapouite
Copy link
Contributor

Potential suggestion could be to store a %val{inserted_selections_desc} that is refreshed everytime one of the p or ! commands above are triggered

vim/neovim has the '[ and '] marks: https://neovim.io/doc/user/motion.html#'[ that delimit the beginning and the end of pasted text.

These marks are the foundation if this text-object: https://github.com/saaguero/vim-textobj-pastedtext

lenormf added a commit to lenormf/kakoune that referenced this issue Jul 22, 2021
lenormf added a commit to lenormf/kakoune that referenced this issue Sep 8, 2021
lenormf added a commit to lenormf/kakoune that referenced this issue Oct 3, 2021
lenormf added a commit to lenormf/kakoune that referenced this issue Oct 20, 2021
lenormf added a commit to lenormf/kakoune that referenced this issue Oct 20, 2021
@mawww mawww closed this as completed in 85b78dd Mar 5, 2022
@alexherbo2
Copy link
Contributor

alexherbo2 commented Mar 7, 2022

Can we set the selection orientation to the left for <a-!>, so we can press h after the command to return to the previous position.

TeddyDD pushed a commit to TeddyDD/kakoune that referenced this issue Aug 19, 2022
Gskartwii pushed a commit to Gskartwii/kakoune that referenced this issue Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants