folke / which-key.nvim

💥 Create key bindings that stick. WhichKey helps you remember your Neovim keymaps, by showing available keybindings in a popup as you type.
Apache License 2.0
5.12k stars 163 forks source link

feature: allow disabling dynamic height #649

Closed max397574 closed 1 month ago

max397574 commented 1 month ago

Did you check the docs?

Is your feature request related to a problem? Please describe.

It seems like which key tries to adjust itself to be lower than the cursor-line This is sometimes bad because not all keys are visible and is als just ugly and annoying (which is personal preference though)

Describe the solution you'd like

allow disabling this behavior and always open the window with the same height

Describe alternatives you've considered

just accept it the way it is

Additional context

Will just abuse this field to say congrats to the rewrite. It's amazing how well it turned out and how it integrates with other plugins. Makes the ootb experience much better and feels more customized already while still giving the user full control over everything.

Rishabh672003 commented 1 month ago

Its even worse with the helix preset, as its the one with the biggest height, an option to just turn of the dynamic height would be very much appreciated

https://github.com/user-attachments/assets/4d817862-f1f0-4f55-a644-7858c03adbed

folke commented 1 month ago

This is actually a bug more or less. I just want to make sure the which-key popup doesn't show over the cursor. Will make some improvements.

I'll see later to make it configurable (shouldn't be just the height)

And thank you @max397574!

max397574 commented 1 month ago

but I think it's okay for it to cover the cursor and sometimes can't even really be avoided (if users want the full menu to show all the time) In the case described here and also shown in the "before" screenshot of the pr I actually expect and want it to cover the cursor

folke commented 1 month ago

That makes sense and I actually agree. The only place where it didn't make sense to overlap is in visual mode and probably operator pending mode. I'm thinking of changing it do only try to avoid overlap in visual and op mode, but allow it in normal mode. (and also make it configurable)

max397574 commented 1 month ago

makes sense I guess

I'll suggest something in my pr give me a few minutes

folke commented 1 month ago

Changed to at least check that there's real overlap. @Rishabh672003 this should fix the helix issue.

Rishabh672003 commented 1 month ago

@folke yup that fixes it for helix, thanks

folke commented 1 month ago

Added opts.win.no_overlap set to false to disable

max397574 commented 1 month ago

thank you lgtm

kevinm6 commented 1 month ago

Hi @folke, I’ve just found out this issue and set no_overlap = false since I was encountering the behavior said above (especially the statusline was overlapped by which-key). However I’ve noticed that after set the option to false, the title is showing no more (instead of be enabled by default as reported in the docs) and you have to set it explicitly (win.title = true), is this a expected behavior or a side effect for no_overlap option?

folke commented 1 month ago

Title is only shown if you have a border defined

kevinm6 commented 1 month ago

Title is only shown if you have a border defined

They are defined. Here the examples with title = true and without

title not defined by user

title defined

folke commented 1 month ago

@kevinm6 the problem is that by default the classic preset is active and that overrides the win settings. Just fixed it for title

kevinm6 commented 1 month ago

@folke amazing! Thanks for the fast reply, was more to point it out to you, than add a single line of a Lua assignment