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
13
KEYMAPS.md
13
KEYMAPS.md
|
|
@ -46,6 +46,13 @@ Living reference of every explicit keymap defined in this config. Use `:KeymapsG
|
|||
| n | `<leader>lf` | Format current buffer (synchronous) |
|
||||
| v | `<leader>lf` | Format visual selection |
|
||||
|
||||
## `lua/plugins/nvim-lint.lua`
|
||||
|
||||
| Command | Description |
|
||||
| --- | --- |
|
||||
| `:LintMarkdownEnable` | Enable automatic markdown linting (runs on BufEnter, BufWritePost, InsertLeave) |
|
||||
| `:LintMarkdownDisable` | Disable automatic markdown linting and clear diagnostics |
|
||||
|
||||
## `lua/plugins/gitsigns.lua` *(buffer-local when inside a git repo)*
|
||||
|
||||
| Mode | Key | Description |
|
||||
|
|
@ -160,9 +167,9 @@ Living reference of every explicit keymap defined in this config. Use `:KeymapsG
|
|||
|
||||
| Key | Description |
|
||||
| --- | --- |
|
||||
| `<CR>` | Initialize/expand selection |
|
||||
| `<S-CR>` | Expand to scope |
|
||||
| `<BS>` | Shrink selection |
|
||||
| `+` | Initialize/expand selection |
|
||||
| `g+` | Expand to scope |
|
||||
| `-` | Shrink selection |
|
||||
|
||||
### Textobject selection (`select.keymaps`)
|
||||
|
||||
|
|
|
|||
|
|
@ -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…
Reference in New Issue