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

rc windowing new-client: copy buffer and selections from calling client #5024

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

Conversation

krobelus
Copy link
Contributor

@krobelus krobelus commented Nov 11, 2023

"new" runs "kak -c" which opens a recently used buffer. More often
than not, I rather want to preserve the calling client's buffer and
selections. For example I might select a word and run "new" followed by
"grep" on the selected word. If the selection is preserved I can use
"new grep". A similar scenario is "new lsp-definition".

Make "new" use the calling client's buffer and selections to support
such scenarios. Center the viewport with vv, matching edit <file> <line>.

Vim does this in <c-w><c-v>.

Another scenario is when I want to look at two regions from a file,
side-by-side.

@krobelus krobelus force-pushed the new-to-clone-selection branch 2 times, most recently from 73a7f09 to d02d5a9 Compare November 16, 2023 13:30
"new" runs "kak -c" which opens a recently used buffer.  More often
than not, I rather want to preserve the calling client's buffer and
selections. For example I might select a word and run "new" followed by
"grep" on the selected word. If the selection is preserved I can use
"new grep".  A similar scenario is "new lsp-definition".

Make "new" use the calling client's buffer and selections to support
such scenarios. Center the viewport with vv, matching "edit <file>
<line>".

Vim does this in <c-w><c-v>.

Another scenario is when I want to look at two regions from a file,
side-by-side.

My initial patch used the code below but Zz seems better:

	echo "try %|
	    buffer -- '$(printf %s "$kak_buffile" | sed "s/'/''/g; s/|/||/g")'
	    select $kak_selections_desc
	    execute-keys vv
	|"
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.

None yet

1 participant