liuchengxu / vim-which-key

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

Open window callback #142

Closed stellarhoof closed 1 year ago

stellarhoof commented 4 years ago

Is your feature request related to a problem? Please describe. I want to display a custom floating window

Describe the solution you'd like A callback which leaves all window-opening details to the user

Here's a function I use to open a window with borders (among other things): https://github.com/neovim/neovim/issues/9718#issuecomment-546603628. I can use it with fzf.vim like let g:fzf_layout = {'window': 'call core#centered_floating_window(v:true)'}. I'd love if I could reuse that function with this library. In fact, that'd allow much more flexibility than the current *g:which_key_floating_opts* option.

Thanks!

rene-descartes2021 commented 1 year ago

Looking at that linked comment, looks like this specific use-case had to do with adding a border to Neovim. Which appears to have since been added via the border field of the {opts} parameter of nvim_open_win().

Doesn't look like g:fzf_layout is in fzf.vim anymore.

I think it's an interesting pattern to explore, a callback to allow the consumer to set up constraints on the window location/layout which the plugin will then fill in. Perhaps for someone else to explore and advocate for, beyond the scope of vim-which-key. EDIT: One suggestion would be to support the extension of Shougo's line of work with the UI framework ddu.vim, all sorts of possibilities.

What is left is essentially duplicate with #180 so closing this.

I'll probably add something similarly named to g:which_key_floating_opts to allow setting {opts} fields explicity on the window creation function, which would fix #210, and also permit changing the border. Related is vim-clap's approach.