Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Command mode prompt doesn't show until user types, when mapping opens command mode #553

Closed
3 tasks done
dylan-chong opened this issue Dec 10, 2023 · 6 comments
Closed
3 tasks done
Labels
bug Something isn't working stale

Comments

@dylan-chong
Copy link

Did you check docs and existing issues?

  • I have read all the which-key.nvim docs
  • I have searched the existing issues of which-key.nvim
  • 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

  1. nvim -u repro.lua
  2. Type <space>%
  3. Nothing will happen.
  4. 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
@dylan-chong dylan-chong added the bug Something isn't working label Dec 10, 2023
@dylan-chong
Copy link
Author

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"
}

dylan-chong added a commit to dylan-chong/dotfiles that referenced this issue Jan 21, 2024
dylan-chong added a commit to dylan-chong/dotfiles that referenced this issue Jan 21, 2024
@jonathf
Copy link

jonathf commented Feb 9, 2024

I have the same issue on MacOS. Workaround also work, but not with Noice unfortunatly. It forces traditional cmd mode.

Copy link
Contributor

github-actions bot commented Jul 6, 2024

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.

@github-actions github-actions bot added the stale label Jul 6, 2024
@dylan-chong
Copy link
Author

still an issue

@folke folke closed this as completed Jul 12, 2024
@jonathf
Copy link

jonathf commented Jul 19, 2024

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?

@jonathf
Copy link

jonathf commented Jul 19, 2024

Not exactly the same, but maybe related: 0xAdk/full_visual_line.nvim/issues/4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

3 participants