Configuring markdownlint-cli2 in LazyVim

Using shell variables like $HOME in LazyVim’s nvim-lint configuration doesn’t work as expected—the string gets passed literally instead of being expanded. To use a custom markdownlint-cli2 config file with a machine-agnostic path, use Lua’s os.getenv() function: 1 2 3 4 5 6 7 8 9 10 11 12 local HOME = os.getenv("HOME") return { "mfussenegger/nvim-lint", optional = true, opts = { linters = { ["markdownlint-cli2"] = { args = { "--config", HOME .. "/.markdownlint-cli2.yaml", "--" }, }, }, }, } Create your ~/.markdownlint-cli2.yaml configuration file with your preferred rules: ...

January 7, 2026 · 1 min · 98 words · rustikus