feat(nvim): Markdown: QoL plugins and settings

- Link creation: autocommand to add <leader>ml shortcut for converting
  selected text to link
- Formatting: Use markdown-toc to format available TOC
- LSP: Add markdown-toc & markdownlint to Mason ensure_installed
- Plugin: render-markdown.nvim with pretty colors to make Obsidian-esk
  rendering
- Plugin: bullets.nvim for easier bullet-point operations (auto indent,
  auto increment numbers, etc.)
- Chore: Move all markdown plugins to lang-markdown.lua
- Plugin: img-clip.nvim: Paste screenshots from system-clipboard to
markdown (also create store the image as webp)
- Plugin: image.nvim: Show images across neovim. Renders image tags on
markdown
This commit is contained in:
Pratik Tripathy
2025-01-06 17:04:44 +05:30
parent d4f25554e1
commit 36f9e5d0b3
5 changed files with 197 additions and 78 deletions

View File

@@ -35,3 +35,24 @@ vim.api.nvim_create_autocmd("FileType", {
end,
nested = true,
})
vim.api.nvim_create_autocmd("FileType", {
group = vim.api.nvim_create_augroup("markdown-keymaps", { clear = true }),
pattern = { "markdown", "gitcommit", "text" },
callback = function()
vim.keymap.set("v", "<leader>ml", function()
-- Save visually selected text to register 'v'
vim.cmd('normal! "vy')
-- Delete the selected text
vim.cmd("normal! gvd")
-- Get the content of the system clipboard
local clipboard_content = vim.fn.getreg("+")
-- Insert the markdown link
local link = string.format("[%s](%s)", vim.fn.getreg("v"), clipboard_content)
vim.api.nvim_put({ link }, "c", false, true)
-- Move cursor inside the square brackets
vim.cmd("normal! F[l")
end, { desc = "Markdown: Make link" })
end,
nested = true,
})