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: Default Neovim plugins (such as matchparen & matchit) are not autoloading #306

Closed
3 tasks done
bluz71 opened this issue Jan 4, 2023 · 33 comments · Fixed by #312
Closed
3 tasks done

bug: Default Neovim plugins (such as matchparen & matchit) are not autoloading #306

bluz71 opened this issue Jan 4, 2023 · 33 comments · Fixed by #312
Labels
bug Something isn't working

Comments

@bluz71
Copy link

bluz71 commented Jan 4, 2023

Did you check docs and existing issues?

  • I have read all the lazy docs
  • I have searched the existing issues of lazy
  • I have searched the exsiting issues of the plugin I have a problem with

Neovim version (nvim -v)

NVIM v0.8.1

Operating system/version

Linux Mint 21.1

Describe the bug

This is follow up from the discussion What is the easiest way to re-enable the standard matchparen plugin?.

In my case, the default matchparen and matchit plugin, installed in /usr/local/nvim-linux64/share/nvim/runtime/plugin directory, are not autoloading as seen in this :scriptnames result

scriptnames

@folke in the #293 discussion made it known that all standard Neovim plugins in the rtp should automatically load. In my case they do not, see the next step for the minimal repo steps.

Steps To Reproduce

  1. Create this ~/.config/nvim/init.lua file:
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)
local lazy = require("lazy")
lazy.setup({})
  1. Run nvim followed by :scriptnames and look for matchparen plugin; it will be missing, at least it is for myself.

  2. Now run standard nvim via nvim --clean followed by :scriptnames and look for matchparen plugin; it will be loaded automatically.

Expected Behavior

lazy.nvim should load nvim/runtime/plugin plugins including matchparen.

Repro

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)
local lazy = require("lazy")
lazy.setup({})
@bluz71 bluz71 added the bug Something isn't working label Jan 4, 2023
@folke
Copy link
Owner

folke commented Jan 4, 2023

What's the output of :lua= vim.env.VIMRUNTIME? It seems your install does not use the default paths.

@bluz71
Copy link
Author

bluz71 commented Jan 4, 2023

:lua= vim.env.VIMRUNTIME output is: /usr/local/nvim-linux64/share/nvim/runtime

My actual Neovim is the packaged Neovim from the releases Github page. I take the official *.tar.gz Linux file and just expand it into /usr/local.

I don't believe I am doing anything weird or unusual.

In Packer.nvim the matchparen and matchit plugins were loading by default (if that's a useful data point).

@bluz71
Copy link
Author

bluz71 commented Jan 4, 2023

Note, the matchparen package is installed in:

/usr/local/nvim-linux64/share/nvim/runtime/plugin/matchparen.vim.

@folke
Copy link
Owner

folke commented Jan 4, 2023

What is vim.opt.rtp:get()?

@bluz71
Copy link
Author

bluz71 commented Jan 4, 2023

Empty string.

@folke
Copy link
Owner

folke commented Jan 4, 2023

you need to print it, like :lua= vim.opt.rtp:get()

@bluz71
Copy link
Author

bluz71 commented Jan 4, 2023

Ok, I needed to format it for you.

{ "/home/bluz71/.config/nvim",
  "/home/bluz71/.local/share/nvim/lazy/lazy.nvim",
  "/home/bluz71/.local/share/nvim/lazy/hop.nvim",
  "/home/bluz71/.local/share/nvim/lazy/fern-git-status.vim",
  "/home/bluz71/.local/share/nvim/lazy/fern.vim",
  "/home/bluz71/.local/share/nvim/lazy/plenary.nvim",
  "/home/bluz71/.local/share/nvim/lazy/gitsigns.nvim",
  "/home/bluz71/.local/share/nvim/lazy/vim-indent-object",
  "/home/bluz71/.local/share/nvim/lazy/vim-surround",
  "/home/bluz71/.local/share/nvim/lazy/undotree",
  "/home/bluz71/.local/share/nvim/lazy/editorconfig-vim",
  "/home/bluz71/.local/share/nvim/lazy/VimCompletesMe",
  "/home/bluz71/.local/share/nvim/lazy/vim-projectionist",
  "/home/bluz71/.local/share/nvim/lazy/vim-repeat",
  "/home/bluz71/.local/share/nvim/lazy/nvim-colorizer.lua",
  "/home/bluz71/.local/share/nvim/lazy/vim-wordmotion",
  "/home/bluz71/projects/public/vim-moonfly-colors",
  "/home/bluz71/.local/share/nvim/lazy/clever-f.vim",
  "/home/bluz71/.local/share/nvim/lazy/targets.vim",
  "/home/bluz71/.local/share/nvim/lazy/MatchTag",
  "/home/bluz71/projects/public/vim-mistfly-statusline ",
  "/home/bluz71/.local/share/nvim/lazy/vim-auto-save",
  "/home/bluz71/.local/share/nvim/lazy/vim-obsession",
  "/home/bluz71/projects/public/vim-nightfly-colors",
  "/usr/local/nvim-linux64/share/nvim/runtime",
  "/usr/local/nvim-linux64/share/nvim/runtime/pack/dist/opt/matchit",
  "/usr/local/nvim-linux64/lib/nvim",
  "/home/bluz71/.config/nvim/after",
  "/home/bluz71/.local/state/nvim/lazy/readme" }

@folke
Copy link
Owner

folke commented Jan 4, 2023

Can't reproduce this. What does nvim -u of the below show?

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)

local function rtp()
  for _, p in ipairs(vim.opt.rtp:get()) do
    print(p)
  end
end

rtp()
local lazy = require("lazy")
lazy.setup({})

print("\nafter:")
rtp()
vim.cmd.scriptnames()

@bluz71
Copy link
Author

bluz71 commented Jan 4, 2023

Oh dear, I feel bad that my setup seems so different. Anyway, the result.

nvim -u config.lua:

/home/bluz71/.local/share/nvim/lazy/lazy.nvim
/home/bluz71/.config/nvim
/etc/xdg/xdg-cinnamon/nvim
/etc/xdg/nvim
/home/bluz71/.local/share/nvim/site
/usr/share/cinnamon/nvim/site
/usr/share/gnome/nvim/site
/home/bluz71/.local/share/flatpak/exports/share/nvim/site
/var/lib/flatpak/exports/share/nvim/site
/usr/local/share/nvim/site
/usr/share/nvim/site
/usr/local/nvim-linux64/share/nvim/runtime
/usr/local/nvim-linux64/lib/nvim
/usr/share/nvim/site/after
/usr/local/share/nvim/site/after
/var/lib/flatpak/exports/share/nvim/site/after
/home/bluz71/.local/share/flatpak/exports/share/nvim/site/after
/usr/share/gnome/nvim/site/after
/usr/share/cinnamon/nvim/site/after
/home/bluz71/.local/share/nvim/site/after
/etc/xdg/nvim/after
/etc/xdg/xdg-cinnamon/nvim/after
/home/bluz71/.config/nvim/after
after:
/home/bluz71/.config/nvim
/home/bluz71/.local/share/nvim/lazy/lazy.nvim
/usr/local/nvim-linux64/share/nvim/runtime
/usr/local/nvim-linux64/lib/nvim
/home/bluz71/.config/nvim/after
/home/bluz71/.local/state/nvim/lazy/readme
  1: /usr/local/nvim-linux64/share/nvim/runtime/ftplugin.vim
  2: /usr/local/nvim-linux64/share/nvim/runtime/indent.vim
  3: ~/config.lua
  4: /usr/local/nvim-linux64/share/nvim/runtime/filetype.lua
  5: ~/dotfiles/nvim/after/plugin/abbreviations.lua
  6: ~/dotfiles/nvim/after/plugin/auto-save.lua
  7: ~/dotfiles/nvim/after/plugin/clever-f.lua
  8: ~/dotfiles/nvim/after/plugin/colorizer.lua
  9: ~/dotfiles/nvim/after/plugin/diagnostic.lua
 10: ~/dotfiles/nvim/after/plugin/editorconfig.lua
 11: ~/dotfiles/nvim/after/plugin/markdown.lua
 12: ~/dotfiles/nvim/after/plugin/mistfly.lua
 13: ~/dotfiles/nvim/after/plugin/obsession.lua
 14: ~/dotfiles/nvim/after/plugin/projectionist.lua
 15: ~/dotfiles/nvim/after/plugin/undotree.lua

@folke
Copy link
Owner

folke commented Jan 4, 2023

That's not right. That looks like config.performance.rtp.reset=false has been set?
edit: nevermind

@bluz71
Copy link
Author

bluz71 commented Jan 4, 2023

My actual lazy configuration if that is of interest. It shouldn't be, but a data point if interested.

@folke
Copy link
Owner

folke commented Jan 4, 2023

Add the below to that init.lua

local Util = require("lazy.core.util")
Util.walk(vim.env.VIMRUNTIME .. "/plugin", function(path, name, t)
  print(table.concat({ path, name, t }, " | "))
end)

What does that print?

@folke
Copy link
Owner

folke commented Jan 4, 2023

Also, does it load the scripts with the minimal init when setting performance.rtp.reset = false?

@bluz71
Copy link
Author

bluz71 commented Jan 4, 2023

I added that code to your custom config, not my my actual lazy config:

/usr/local/nvim-linux64/share/nvim/runtime/plugin/gzip.vim | gzip.vim
/usr/local/nvim-linux64/share/nvim/runtime/plugin/health.vim | health.vim
/usr/local/nvim-linux64/share/nvim/runtime/plugin/man.lua | man.lua
/usr/local/nvim-linux64/share/nvim/runtime/plugin/matchit.vim | matchit.vim
/usr/local/nvim-linux64/share/nvim/runtime/plugin/matchparen.vim | matchparen.vim
/usr/local/nvim-linux64/share/nvim/runtime/plugin/netrwPlugin.vim | netrwPlugin.vim
/usr/local/nvim-linux64/share/nvim/runtime/plugin/rplugin.vim | rplugin.vim
/usr/local/nvim-linux64/share/nvim/runtime/plugin/shada.vim | shada.vim
/usr/local/nvim-linux64/share/nvim/runtime/plugin/spellfile.vim | spellfile.vim
/usr/local/nvim-linux64/share/nvim/runtime/plugin/tarPlugin.vim | tarPlugin.vim
/usr/local/nvim-linux64/share/nvim/runtime/plugin/tohtml.vim | tohtml.vim
/usr/local/nvim-linux64/share/nvim/runtime/plugin/tutor.vim | tutor.vim
/usr/local/nvim-linux64/share/nvim/runtime/plugin/zipPlugin.vim | zipPlugin.vim

@folke
Copy link
Owner

folke commented Jan 4, 2023

the file type is missing in that list, so that would not work. It should have | file or | link at the end.

What does $ ls -l /local/nvim-linux64/share/nvim/runtime/plugin/gzip.vim show?

@bluz71
Copy link
Author

bluz71 commented Jan 4, 2023

the file type is missing in that list, so that would not work. It should have | file or | link at the end.

What does $ ls -l /local/nvim-linux64/share/nvim/runtime/plugin/gzip.vim show?

ls: cannot access '/local/nvim-linux64/share/nvim/runtime/plugin/gzip.vim': No such file or directory

But note, my Neovim is installed in /usr/local/, your ls command is for /local/

ls -l /usr/local/nvim-linux64/share/nvim/runtime/plugin/gzip.vim produces this:

-rw-r--r-- 1 bluz71 users 3.0K Nov 14 20:17 /usr/local/nvim-linux64/share/nvim/runtime/plugin/gzip.vim

@bluz71
Copy link
Author

bluz71 commented Jan 4, 2023

Also, does it load the scripts with the minimal init when setting performance.rtp.reset = false?

No difference; matchparen is not automatically loaded.

@folke
Copy link
Owner

folke commented Jan 4, 2023

I meant /usr/local indeed. Superweird that Neovim can't stat those files

The output shold be like this:
image

Do you have something like app armor enabled?

@folke
Copy link
Owner

folke commented Jan 4, 2023

Inside vim, what does the code below show?

:lua= vim.loop.fs_stat("/usr/local/nvim-linux64/share/nvim/runtime/plugin/gzip.vim")

@bluz71
Copy link
Author

bluz71 commented Jan 4, 2023

I believe I do, just because Linux Mint automatically installs it. I didn't do anything to set it up; it just exists (because Ubuntu uses it and Linux Mint is a derivative).

That is a reasonable hypothesis.

The only weird thing is that packer.nvim had no issues AND default Neovim via nvim --clean has no issues either (loading matchparen).

@bluz71
Copy link
Author

bluz71 commented Jan 4, 2023

Inside vim, what does the code below show?

:lua= vim.loop.fs_stat("/usr/local/nvim-linux64/share/nvim/runtime/plugin/gzip.vim")
{
  atime = {
    nsec = 562507627,
    sec = 1672815403
  },
  birthtime = {
    nsec = 0,
    sec = 0
  },
  blksize = 4096,
  blocks = 8,
  ctime = {
    nsec = 61252620,
    sec = 1668576015
  },
  dev = 2054,
  flags = 0,
  gen = 0,
  gid = 100,
  ino = 402696138,
  mode = 33188,
  mtime = {
    nsec = 0,
    sec = 1668417434
  },
  nlink = 1,
  rdev = 0,
  size = 3046,
  type = "file",
  uid = 1882
}

@folke
Copy link
Owner

folke commented Jan 4, 2023

I'm sure I can access those files, but NEovim doesn't seem to be able to stat the files

@folke
Copy link
Owner

folke commented Jan 4, 2023

See? There's no type in that stat info

@bluz71
Copy link
Author

bluz71 commented Jan 4, 2023

% stat /usr/local/nvim-linux64/share/nvim/runtime/plugin/gzip.vim

  File: /usr/local/nvim-linux64/share/nvim/runtime/plugin/gzip.vim
  Size: 3046      	Blocks: 8          IO Block: 4096   regular file
Device: 806h/2054d	Inode: 402696138   Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1882/  bluz71)   Gid: (  100/   users)
Access: 2023-01-04 17:56:43.562507627 +1100
Modify: 2022-11-14 20:17:14.000000000 +1100
Change: 2022-11-16 16:20:15.061252620 +1100
 Birth: -

@folke
Copy link
Owner

folke commented Jan 4, 2023

yep, but from inside vim, that fs_stat call should include type="file" and it doesn't

@folke
Copy link
Owner

folke commented Jan 4, 2023

oh wait, that is in there

@folke
Copy link
Owner

folke commented Jan 4, 2023

local handle = vim.loop.fs_scandir(vim.env.VIMRUNTIME .. "/plugin")
while handle do
  local name, t = vim.loop.fs_scandir_next(handle)
  if not name then
    break
  end
  print(name .. " | " .. (t or "no type"))
end

@bluz71
Copy link
Author

bluz71 commented Jan 4, 2023

gzip.vim | no type
health.vim | no type
man.lua | no type
matchit.vim | no type
matchparen.vim | no type
netrwPlugin.vim | no type
rplugin.vim | no type
shada.vim | no type
spellfile.vim | no type
tarPlugin.vim | no type
tohtml.vim | no type
tutor.vim | no type
zipPlugin.vim | no type

@folke
Copy link
Owner

folke commented Jan 4, 2023

yeah, so that's not normal. I could make it work by assuming an empty type is a file, but that would still fail when sourcing sub directories

@bluz71
Copy link
Author

bluz71 commented Jan 4, 2023

AppArmour maybe is the issue.

I may have to move my Neovim installation out of /usr/local; maybe to /opt instead.

I don't mind if we close this down as being super-weird (only happening to me).

Your calll, you have done a great deal already to debug this.

@bluz71
Copy link
Author

bluz71 commented Jan 4, 2023

Ok, I just downloaded nvim 8.2 and installed it into /tmp.

All the plugins load correctly, including matchparen.

100% this is AppArmour (probably related to /usr/local directory) buggering up your File stating code.

@folke folke closed this as completed in 2e87520 Jan 4, 2023
@folke
Copy link
Owner

folke commented Jan 4, 2023

I just pushed a change that defaults to type="file", but as I mentioned, other things could still break. So indeed best to fix that app armor issue

@bluz71
Copy link
Author

bluz71 commented Jan 4, 2023

Do you want to revert that change? I am fine with you doing that.

My AppArmour issue requires me to fix my end. I likely just need to move my Neovim installation of out /usr/local to somewhere else (I think that will fix it).

But keep this issue in mind if other users have super weird issues.

Many thanks @folke. Great work on this excellent plugin manager.

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

Successfully merging a pull request may close this issue.

2 participants