which-key.nvim
which-key.nvim copied to clipboard
fix: fix #301
Just curious, what’s this echo used for?
Tested around a bit and works fine for me without vim.cmd [[echon ""]]
Is there a reason to keep that dummy output?
I think it is used for clear current command line. It is not needed for cmdheight=0
though.
I think it is used for clear current command line. It is not needed for
cmdheight=0
though.
echon
works well no matter what the value of cmdheight
is, I don't think it's necessary to add a check for cmdheight
, just keep it simple
@registerGen @jemag It's used to clear the input context https://github.com/folke/which-key.nvim/blob/bd4411a2ed4dd8bb69c125e339d837028a6eea71/lua/which-key/layout.lua#L89
this also works
@Shougo echo will definitely cause waiting for enter, is it expected?
@Shougo echo will definitely cause waiting for enter, is it expected?
It is expected. Because you have not command line area.
Please see cmdheight
description.
*'cmdheight'* *'ch'*
'cmdheight' 'ch' number (default 1)
global
Number of screen lines to use for the command-line. Helps avoiding
|hit-enter| prompts.
The value of this option is stored with the tab page, so that each tab
page can have a different value.
When 'cmdheight' is zero, it disables echo area and all outputs need
|hit-enter| prompt.
@Shougo Oh, I forgot to read the help about cmdheight, thanks for the tip
This also affects gq
For those affected, if you prefer not to install the fork branch, you can dynamically patch which-key while we wait for review and merge:
put this somewhere in your config, I put it in the bottom of the file which calls wk.setup
---PATCH from https://github.com/folke/which-key.nvim/pull/305
local wk_view = require 'which-key.view'
wk_view.hide = function()
vim.api.nvim_echo({ { "" } }, false, {})
vim.cmd 'redraw'
wk_view.hide_cursor()
if wk_view.buf and vim.api.nvim_buf_is_valid(wk_view.buf) then
vim.api.nvim_buf_delete(wk_view.buf, { force = true })
wk_view.buf = nil
end
if wk_view.win and vim.api.nvim_win_is_valid(wk_view.win) then
vim.api.nvim_win_close(wk_view.win, { force = true })
wk_view.win = nil
end
end
---ENDPATCH