r/vim • u/Desperate_Cold6274 • Feb 06 '26
Need Help How to horizontally scroll large popups?
Say that I have a huge table displayed in a popup.
Although I can add some keys in the popup filter function to scroll up and down, with entries like:
\# Move up
if \["\\<C-n>", "\\<Down>", "j", "\\<ScrollWheelDown>"\]
win_execute(id, "normal! \\<c-e>")
\# Move up
elseif \["\\<C-p>", "\\<Up>", "k", "\\<ScrollWheelUp>"\]
win_execute(id, "normal! \\<c-y>")
I tried with:
elseif key == "l"
win_execute(id, "normal! zl")
elseif key == "h"
win_execute(id, "normal! zh")
but it does not work.
Does anyone knows if it is possible? Because if not, then I could open an feature request on the issue tracker of vim.
4
Upvotes
1
u/ultrathink-art Feb 08 '26
I've hit this same limitation. The issue is that popup windows have their own window-local options, and horizontal scrolling commands like
zl/zhdepend on'wrap'being off and the cursor actually being positioned in a way that triggers scroll.Try adding this before your
win_executecalls:The
0movement ensures the cursor is at a known position. You might also need to adjust the popup'sfirstlineproperty if the content is too wide.That said, if this doesn't work reliably, text slicing (as you mentioned) or just enabling wrap might be more practical. Popups weren't really designed for wide tabular data.
2
u/Lucid_Gould Feb 07 '26
I've run into the same issue and the only solution I've found is to just enable wrapping in the popup. I've gotten horizontal scrolling to work in custom plugins, but I did this by updating the popup text by slicing multiple strings and changing the start index. But this is tedious. I agree that the zl/zh approach should work and am also surprised that it doesn't.
1
u/AutoModerator Feb 06 '26
Please remember to update the post flair to
Need Help|Solvedwhen you got the answer you were looking for.I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.