Closed mrs4ndman closed 1 month ago
Additional issue description:
I hit an issue with using <C-r>
to paste into the command line buffer. This will open the current registers in which-key. It would leave me in an undesirable state with the which-key "registers" window open, but immediately throwing an error and the which-key window failing to close afterwards. This would hide the contents of the command line buffer.
Not a fix, but potential workaround is disabling which-key in the "command line" buffer. For this workaround, you may configure which-key to disable in filetype "vim" , which the command buffer is using:
{
disable = {
filetypes = { "vim" },
}
}
See which-key docs
Additional issue description: I hit an issue with using
<C-r>
to paste into the command line buffer. This will open the current registers in which-key. It would leave me in an undesirable state with the which-key "registers" window open, but immediately throwing an error and the which-key window failing to close afterwards. This would hide the contents of the command line buffer.Not a fix, but potential workaround is disabling which-key in the "command line" buffer. For this workaround, you may configure which-key to disable in filetype "vim" , which the command buffer is using:
{ disable = { filetypes = { "vim" }, } }
See which-key docs
setting filetype to vim is not good. maybe we can disable it directly in code.
I am getting the same error, the patch from @konosubakonoakua works here. Ideally there should be a way to disable lua plugins, not sure how to go about it with or without LazyVim?
In LazyVim
-- boolean to enable or disable plugin on BufWinEnter?
new_opt = function() return vim.api.nvim_get_mode().mode == "c" end,
Create your own lua, this is not the correct way but this is the idea.
local ag_cmdmode = vim.api.nvim_create_augroup('cmdmode', { clear = true })
-- vim.api.nvim_create_autocmd
vim.api.nvim_create_autocmd('CmdLineEnter', {
group = ag_cmdmode,
callback = function ()
require('which-key').setup({new_enabled_cmd = false})
end
})
vim.api.nvim_create_autocmd('CmdLineLeave', {
group = ag_cmdmode,
callback = function ()
require('which-key').setup({new_enabled_cmd = false})
end
})
workaround for disabling which-key in command-line windows, without disabling it for vim
filetype (involves monkey-patching which-key):
local view = require("which-key.view")
local is_enabled_orig = view.is_enabled
view.is_enabled = function(bufnr)
return is_enabled_orig(bufnr) and vim.fn.getcmdwintype() == ""
end
Did you check docs and existing issues?
Neovim version (nvim -v)
NVIM v0.10.0-dev-1932+gd9d9d9434
Operating system/version
Pop_OS 22.04 (Linux)
Describe the bug
which-key presents an error → In the Command-line window (opened with q:, you hit the![image](https://github.com/folke/which-key.nvim/assets/121260905/ab1dc776-e3d6-4cf0-b53d-9afbc1e264e2)
Leader
key for completing available keybinds → Hit the wrong key (e
ort
instead ofw
as in the example) → Which-key gives an error and doesn't remove it's previous window. Resulting viewSteps To Reproduce
Steps to reproduce:
Run
nvim -u repro.lua
with the provided repro.luaOnce inside Neovim, hit
q:
Then, while inside the Command Line buffer, hit Space + q (
leader
+ q) instead of the defined Space + wleader + w
keybind. Which-key presents this error:The previous
which-key
window is still rendered on the bottom part of the screen, and only disappears on Neovim restart.Expected Behavior
The which-key window should disappear without erroring out
Repro