chrisbra / matchit

The matchit plugin from Vim
61 stars 9 forks source link

`:MatchEnable` and `:MatchDisable` Commands Not Available #38

Closed Ddystopia closed 1 year ago

Ddystopia commented 1 year ago

I'm using the matchit.vim plugin in my Neovim setup with the lazy.nvim package manager. The plugin seems to be loading correctly, as I can see matchit.vim in the list of sourced scripts when I run :scriptnames. However, the :MatchEnable and :MatchDisable commands are not available. When I try to run these commands, I get an error message saying that the command doesn't exist.

Interestingly, the :MatchDebug command is available and setting b:match_debug to 1.

:echo b:match_debug
1

Steps to Reproduce

  1. Open Neovim.
  2. Run :MatchEnable or :MatchDisable.
  3. Observe that these commands are not available.
  4. Run :MatchDebug.
  5. Observe that this command is available and sets b:match_debug to 1.

Expected Behavior

The :MatchEnable, :MatchDisable, and :MatchDebug commands should all be available. :MatchEnable and :MatchDisable should enable or disable the matchit plugin when run, and :MatchDebug should set b:match_debug to 1.

Actual Behavior

When I try to run :MatchEnable or :MatchDisable, I get an error message saying that the command doesn't exist. However, the :MatchDebug command works as expected.

Environment

Run :checkhealth for more info


- Plugin manager: lazy.nvim
- Operating system: Arch Linux

I would appreciate any help in resolving this issue. Thank you!
chrisbra commented 1 year ago

how did you run install it?

Ddystopia commented 1 year ago

This seems to me to be sufficient as a minimal reproducible example

init.lua:

local M = {
  'chrisbra/matchit'
}

local lazypath = vim.fn.stdpath("data") .. "/lazy/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",
    "--branch=stable",
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({ M }, {})

Open neovim with that config nvim -u path/to/init.lua

It could clone repo of lazy.nvim for some time at the beginning.

chrisbra commented 1 year ago

Wait, before I go into the defaults of Neovim and lazynvim can you please check, if your checked out version of matchit contains:

https://github.com/chrisbra/matchit/blob/master/plugin/matchit.vim#L109-L120

It it works, please clone as package to rule out lazy.nvim and see if it works then.

chrisbra commented 1 year ago

In particular, please make sure you are not accidentally using https://github.com/neovim/neovim/tree/master/runtime/pack/dist/opt/matchit

Ddystopia commented 1 year ago

Oh, I think I am using https://github.com/neovim/neovim/tree/master/runtime/pack/dist/opt/matchit

$HOME/.local/share/nvim/lazy/matchit/plugin/matchit.vim: image

chrisbra commented 1 year ago

ah makes sense. I should probably send out the new matchit for inclusion with Vim. I'll do this soon (and neovim should also then get it eventually)

chrisbra commented 1 year ago

I tagged a new release and will send and update to Vim. So closing.

chrisbra commented 1 year ago

I sent an update to Bram: https://github.com/vim/vim/pull/12611