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

Make the floating window scrollable or able to have cursor on it #9

Open
wookayin opened this issue Jan 27, 2020 · 8 comments
Open

Comments

@wookayin
Copy link
Contributor

wookayin commented Jan 27, 2020

Some plugins like git-messenger.vim that opens up a floating window allow:

(i) to move cursor to the window (e.g. CTRL-W W) --- and then one can navigate using movement keys,
(ii) to scroll the window using mouse wheels.

This would be particularly useful when one need to see more lines a bit off around the symbol definition, quickfix location, etc. The current behavior is that the floating window opened by quickui is not focusable nor scrollable.

It would be great if we can customize this behavior with an argument!

@skywind3000
Copy link
Owner

which widget are you referring to? preview window ?

I intentionally made preview window unfocusable, because you do not need to close it manually. The “close” action will actually break your workflow. I don’t want this interruption, so it is unfocusable.

But there is already a

quickui#preview#scroll()

for this and you can map it to alt+f or alt+b to scroll forward or backward without focusing on it.

@wookayin
Copy link
Contributor Author

Hi @skywind3000, thanks for your comment. Yes, sorry I forgot to say I was referring to preview windows (e.g. quickui#preview#open).

For example, let's imagine a preview windows is opened and one may want to scroll this pop-up window to see more lines. Scrolling mouse wheels would be very intuitive but the focus is lost, and the main window (buffer) scrolls:

2020-01-27 15 38 26

As a comparison, the floating window from coc.nvim or git-messenger is scrollable and focusable, making it easy to navigate and look around:

2020-01-27 15 45 13

And these plugins would also close windows automatically when a cursor (from the original window) is moved. I think this behavior is very intuitive and handy.

@skywind3000
Copy link
Owner

fair, I will look into this later

@skywind3000
Copy link
Owner

updated, preview window can scroll now.

@wookayin
Copy link
Contributor Author

wookayin commented Feb 2, 2020

Awesome. Looking at commit d00c435, seems we have the following configurable point:

  • g:quickui_preview_focusable (defaults 1)
  • opts = {'focusable' : 1}

Thank you! Also, could we allow place a cursor on it rather than closing?

@skywind3000
Copy link
Owner

skywind3000 commented Feb 6, 2020

important change, since more arguments have been introduced in preview window open function. it is more flexible to organize them in a dictionary, see the documentation for available options:

https://github.com/skywind3000/vim-quickui#preview-window

@leoatchina
Copy link

Is there any way to judge if a preview popup/floating window exists?
I want to use ctrl+j/k to scroll the preview windows if it appeared, otherwise they should work normally

@gluonman
Copy link

This is one of the coolest vim plugins I've encountered, and I love it. I mainly like it as a way to keep visual references, like keybinding cheat sheets and help docs, inside of vim so that I don't feel the need to switch to a browser to google for a reminder of how to do something I haven't done in a while, or opening another terminal to peak into my init.vim to grep for the relevant command and remind myself what I mapped it to. It's also a great addition for anyone trying to build up their vim into an IDE that mimics graphical ones. There are other plugins that allow you to deliver custom content to popups and previews and such, but yours accomplishes this in the way that suits my needs the best, and yours has menus! The first time I installed your plugin and tested out the context menu that I mapped to my right mouse click, I gasped aloud. To see vim do that was something else. So thank you so much for this. But now that I've gotten my praise aside, let me weigh in on this scrollable preview window issue and hopefully justify my request for this feature to be more complete or configurable.

At least for me and my workflow, I actually find the inability to mousewheel scroll or drag a scrollbar up and down within my preview window to be the most damning flaw this plugin has. In my opinion, this plugin is held back from perfection on this one point. For me, it's more of a concern that there isn't a scrollbar than that I can't mousewheel scroll, because if I open the help and want to go down to a section much further down, I don't want to repeatedly hit the keys I mapped quickui#preview#scroll() to for 5 whole minutes, and I only barely like the sound of mouse-scrolling continuously instead for a few minutes. In that situation, a scrollbar is handy to be able to just swing your way halfway down the entire document to get to a much later section, skipping all of the scrolling. And this is an issue because I am entirely unaware of a way to skip to different sections by name within the help preview once the window is open (I have not found the standard '/' search feature to work while the window is open, though maybe there's some conflict between my use of vim-easymotion and being able to search the preview window). When it comes to other content besides the help docs that's much shorter, then mouse-scrolling some times becomes my preferred way to scroll those particular windows. On paper, I like the idea of mouse-free computing, and the more you can do with the keyboard the faster and more efficient your workflow, since you're not moving back and forth. However, that being said, in practice, there are situations in which I honestly do prefer to use the mouse scrollwheel or to click on things. Maybe I have left the terminal window to focus on something else for a bit and I have vim still open, and I just want to swing the cursor into vim to open a reference of some kind real quick and get some info from it, not necessarily get back to writing code just yet. I've been reading and not typing, and my one hand is holding a smoke while the other is comfortably resting on the mouse as I scroll through what I'm reading. I don't want to break that flow just to go back to being all typity-typity again. I want to mouse-scroll my windows. That's the biggest reason I couldn't ever go full ratpoison.

And one more case for at least having the mouse-scrolling be an option that can be toggled on or off, is that there is a use-case for configuring vim to be easier for someone not used to the typity-typity of the vim workflow to transition to working in a terminal environment. I have a couple students whom I am teaching how to Linux and how to CLI, and while I have emphasized for them the power of a more keyboard-focused workflow, I find that for a lot of people tools that maintain both working styles are the best for making transitions, such as the transition from a purely graphical environment to command line interfaces. I have been working to configure my vim into a full-blown IDE reminiscent of a graphical IDE, so I want those intuitive GUI features to be there, like the clickity-clickity and mouse-scrollableness.

Also, I am a bit hung up on this particular screenshot that you have in your manual under preview windows:
preview-window

It has a scrollbar! Have I completely missed a preview window option that enables or disables that scrollbar? I haven't found it in your documentation, and I haven't found any discussion on the scrollbar specifically. It doesn't feel like a broken feature or plugin conflict because when I enable my verbose log, I am unable to find anything related to an element of the preview window failing to load. So I don't know why my scrollbar is missing, but just that it is. The scrollbar in that picture is my only evidence that scrollbars in preview windows are even a thing. How can I enable my scrollbar and make my preview window mouse-scrollable, please?

Cheers

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

No branches or pull requests

4 participants