liuchengxu / vim-which-key

:tulip: Vim plugin that shows keybindings in popup
https://liuchengxu.github.io/vim-which-key/
MIT License
1.93k stars 66 forks source link

Floating window positioning and decoration #180

Open h0adp0re opened 3 years ago

h0adp0re commented 3 years ago

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

The default layout of the floating window is not something I love. It's very abrupt.

Screenshot 2021-03-25 at 14 13 13

Describe the solution you'd like

An option for something like fzf is doing, note the nice borders around the window. Is this even the same API?

Screenshot 2021-03-25 at 14 12 54

I understand there would be problems to solve if such an option would be implemented. The current options of this plugin assume one of two positions for the window.

Window width and height is also something that fzf does really well, their window is responsive with a min-width and a min-height.

jdeut commented 3 years ago

I think a vim way to evaluate the window placement needs to take the cognitive burden of different window placements into account. Following cognitive load theory the distance between the current visual fixation point on the screen (most likely the position of the cursor) and the screen position of the window is a good estimate for the cognitive burden. Unfortunately people tend to concentrate on aesthetics of the whole graphical representation of the rendered window.

From my perspective the window should be placed at the current position of the cursor and the categorical chunks of the information should be placed in a rectangular grid with minimal vertical and horizontal space between grid rows and grid columns. Incorporating the winblend option could be a further optimization if the needed information is linked to the content in the vicinity of the cursor. In this case eye movement would be minimal and at the same time the reader is still able to access relevant information connected to the invoked action.

As good examples that illustrate my point you can take a look at the floating_relative_cursor setting of Denite and the auto placement that is used by Floaterm.