Add markdown linting commands and update keymaps
- Introduced commands to enable/disable automatic markdown linting. - Updated keymaps to reflect changes in markdown linting behavior.
This commit is contained in:
parent
8c9f117320
commit
c9a7b3b694
3 changed files with 32 additions and 5 deletions
|
|
@ -52,7 +52,7 @@ vim.api.nvim_create_autocmd("FileType", {
|
|||
end,
|
||||
})
|
||||
|
||||
-- Markdown: Prettier defaults (2 spaces)
|
||||
-- Markdown: Prettier defaults (2 spaces) + spellcheck
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = aug,
|
||||
pattern = "markdown",
|
||||
|
|
@ -61,6 +61,7 @@ vim.api.nvim_create_autocmd("FileType", {
|
|||
vim.opt_local.tabstop = 2 -- Display as 2 spaces
|
||||
vim.opt_local.shiftwidth = 2 -- Indent by 2
|
||||
vim.opt_local.softtabstop = 2
|
||||
vim.opt_local.spell = true -- Enable spellcheck for markdown
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ return {
|
|||
javascriptreact = { "eslint_d" },
|
||||
typescript = { "eslint_d" },
|
||||
typescriptreact = { "eslint_d" },
|
||||
markdown = { "markdownlint" },
|
||||
-- markdown linting: manual only (see keymap below)
|
||||
php = { "phpcs" },
|
||||
-- Python: ruff LSP handles linting
|
||||
}
|
||||
|
|
@ -78,5 +78,24 @@ return {
|
|||
lint.try_lint()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Commands to enable/disable automatic markdown linting
|
||||
vim.api.nvim_create_user_command("LintMarkdownEnable", function()
|
||||
lint.linters_by_ft.markdown = { "markdownlint" }
|
||||
vim.notify("Markdown linting enabled (automatic)", vim.log.levels.INFO)
|
||||
-- Lint immediately
|
||||
if vim.bo.filetype == "markdown" then
|
||||
lint.try_lint()
|
||||
end
|
||||
end, { desc = "Enable automatic markdown linting" })
|
||||
|
||||
vim.api.nvim_create_user_command("LintMarkdownDisable", function()
|
||||
lint.linters_by_ft.markdown = nil
|
||||
vim.notify("Markdown linting disabled", vim.log.levels.INFO)
|
||||
-- Clear existing diagnostics for markdown buffers
|
||||
if vim.bo.filetype == "markdown" then
|
||||
vim.diagnostic.reset(lint.get_namespace("markdownlint"))
|
||||
end
|
||||
end, { desc = "Disable automatic markdown linting" })
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue