noice.nvim icon indicating copy to clipboard operation
noice.nvim copied to clipboard

bug: ":hep", ":hl" and ":hp" get recognized as help command

Open anuramat opened this issue 1 year ago • 3 comments

Did you check docs and existing issues?

  • [X] I have read all the noice.nvim docs
  • [X] I have searched the existing issues of noice.nvim
  • [X] I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.9.5

Operating system/version

NixOS 23.11

Describe the bug

Pattern that is used for help command detection (^:%s*he?l?p?%s+) as both false positives (hp, hl, hep) and false negatives (vert he and so on)

Steps To Reproduce

  1. open nvim with installed noice.nvim and default opts
  2. type :hl (with a space)
  3. observe the command getting recognized as help

Expected Behavior

:hl doesn't get recognized as a help command

nice to have: :vert he and so on getting recognized instead (maybe make patterns take string|bool(string) values?)

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/noice.nvim", dependencies = { "MunifTanjim/nui.nvim" }, opts = {} },

	-- add any other plugins here
}
require("lazy").setup(plugins, {
	root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

anuramat avatar Feb 16 '24 20:02 anuramat

obv a minor one but it's triggering me

anuramat avatar Feb 16 '24 20:02 anuramat

Don't know if you've already found this way but by passing a new pattern for the help command, we can modify this behaviour:

require("noice").setup({
  cmdline = {
    format = {
        help = { pattern = { "^:%s*help?%s+", "^:%s*hel?%s+", "^:%s*he?%s+" }},
    },
  },
})

I just modified the regex that was provided in README and atleast in my testing it works correctly.

@folke It would be nice I think to include this or a variation of this in the code so that only h, he, hel and help gets detected as help.

shreyas-a-s avatar Apr 08 '24 18:04 shreyas-a-s

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[bot] avatar Jul 06 '24 01:07 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Jul 13 '24 01:07 github-actions[bot]