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

Scroll other window #86

Open
zaatas opened this issue May 25, 2022 · 6 comments
Open

Scroll other window #86

zaatas opened this issue May 25, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@zaatas
Copy link

zaatas commented May 25, 2022

Thought:
The ability to Scroll and Page Up/Down the "other" window in a split. Other defined as all window/s that do not have the present focus. I'm using a vim script hack I cobbled together a few years ago. Yet, such a feature in this plugin could be most advantageous.

@beauwilliams
Copy link
Collaborator

Ahhh, so in short, being able to scroll the unfocused windows without switching to them. Neat! I can see this would be useful.

How are you managing this with mappings, how do you prefer to set them up?

@beauwilliams beauwilliams added the enhancement New feature or request label Jul 24, 2022
@zaatas
Copy link
Author

zaatas commented Jul 27, 2022

function! ScrollOtherWindow(direction)
execute 'wincmd' (winnr('#') == 0 ? 'w' : 'p')
execute (a:direction ? "normal! <C-y>" : "normal! <C-e>")
wincmd p
endfunction

@zaatas
Copy link
Author

zaatas commented Jul 27, 2022

I'm using mrjones2014/legendary.nvim for mappings + map documentation

local options = { noremap = true, silent = true }

local lhk_keymaps = {
{ "<S-A-j>", ":call ScrollOtherWindow(1)", description = "Scroll Other Win Up", opt = options },
{ "<S-A-k>", ":call ScrollOtherWindow(0)", description = "Scroll Other Win Down", opt = options },
}
require('legendary').bind_keymaps(lhk_keymaps)

@zaatas
Copy link
Author

zaatas commented Aug 7, 2022

Thoughts

@beauwilliams
Copy link
Collaborator

Nice! Yeah this looks good, I think we can have it either automatically use next window, or a way to choose a window. Probably easiest to keep a list also for reference

@zaatas
Copy link
Author

zaatas commented Aug 19, 2022

Thoughts:
Default: From the active window, limit scrolling to the adjacent (L/R) window.
Option: From the active window, (using telescope), select & change the buffer displayed in the adjacent (L/R) window.

Like you, I have limited time and am new to nvim's lua api's. Yet, I'd really like to help add/test, etc. these to your plugin.

I can be reached at: matt@zaatas.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants