Error with Markdown files after enabling lint plugin
Describe the bug
Opening Markdown files throws errors after enabling the link plugin from init.lua.
Opening an .md file directly:
Opening .md file from Neo-tree the first time:
Opening any other file after neo-tree throws initial error:
To Reproduce
- Fresh install of nvim
- Direct clone of Kickstart per the documentation
- Enable lint plugin from
init.lua(optional - enable neo-tree to see other errors) - Open any Markdown files either directly, or through neo-tree
Desktop
- OS: MacOS Sonoma 14.5 (23F79), M3 Max
- Terminal: iTerm 2
Neovim Version
V0.10.0 (through Homebrew)
To lint your file nvim-lint tries to call an external command (markdownlint).
It seems that it can't find markdownlint tool, and that means you need to install it through Mason (it's in the linters tab) or install it on your machine.
@VlaDexa yes! Fixed by adding it to the vim.list_extend(ensure_installed block.. Thanks. Does it make sense to include this within the init.lua file, alongside the stylua requirement? Or perhaps a comment somewhere? I found it confusing to have this error out of the box (as a complete newbie to nvim).
Will this be fixed? Everytime I install kickstart.nvim in a new OS or Container I get this error and I thought I needed to manually install markdownlint via npm install -g markdownlint.
Will this be fixed?
As I see it, installing markdownlint only for everyone who enable lint plugin would require a significant init.lua rewrite to allow passing ensure_installed in opts to mason or directly calling mason-core functions to install markdown lint, which at the very least will not be very pretty to look at. Installing markdownlint for everyone using kickstart, even the ones who don't use the lint plugin, is an easier solution but I don't think it's a good one.
Everytime I install kickstart.nvim in a new OS or Container I get this error
I assume you're installing your fork, which has lint plugin enabled by default. Then, you also can do what @togume did and add it to your ensure_installed in init.lua to solve this error. This would be the easiest and the fastest solution available right now to you.
I agree that this is a problem which affects the user experience, but I don't really have a good way of solving it. Maybe you can take a crack at it?
@VlaDexa Oh I see your point. Thanks for the kind explanation. Yeah I'll follow what togume did for the moment.
In my environment I had to install markdownlint-cli
npm install -g markdownlint-cli
I ran into this when opening a README.md file. To fix, had to install markdownlint-cli. On macOS:
brew install markdownlint-cli
I've run into the same problem after installing npm packages it still preserves an error before opening a .md file:
Error detected while processing BufEnter Autocommands for "*": Error running vale: ENOENT: no such file or directory Press ENTER or type command to continue
I used :Mason to manually install the package to get rid of this error. However, I first had to use apt install npm to get npm up and running. I'm not a frontend programmer so I wasn't intending to install node/npm, but seems to be required to use some of the tools. It's 490 MB of dependencies (yikes!) to install this linter.