which-key.nvim
which-key.nvim copied to clipboard
bug: Command mode prompt doesn't show until user types, when mapping opens command mode
Did you check docs and existing issues?
- [X] I have read all the which-key.nvim docs
- [X] I have searched the existing issues of which-key.nvim
- [X] I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
0.9.4
Operating system/version
Ubuntu 22.04.3 LTS
Describe the bug
Command mode prompt is invisible until user types after triggering the mapping, e.g. the example below (which is in the repro lua)
{ ':echo "hello but not pressing enter"', 'example' }
Steps To Reproduce
nvim -u repro.lua- Type
<space>% - Nothing will happen.
- Type
a
Expected Behavior
Command mode should show up at the end of step 2 with cursor at the end of the line
Repro
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
{ "folke/which-key.nvim", config = true, init = function()
require('which-key').register({
['%'] = { ':echo "hello but not pressing enter"', 'example' }
}, { prefix = '<space>' })
end},
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
For now, i'm working around the issue by using the command mode buffer
function CopyPath(expand)
local string = vim.fn.expand(expand)
vim.fn.setreg('+', string)
print('Copied: ' .. string)
end
lvim.builtin.which_key.mappings['%'] = {
":lua CopyPath('%:p')<Left><Left><Left><C-f>i", -- added <C-f>i
"Copy file path"
}
I have the same issue on MacOS. Workaround also work, but not with Noice unfortunatly. It forces traditional cmd mode.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
still an issue
I have migrated to v3 just now and unfortunatly the issue stills persists. If there is a new v3 way to get around it, please let us know. If not, would it be prudent to reopen?
Not exactly the same, but maybe related: 0xAdk/full_visual_line.nvim/issues/4.