From 97f30479896a42687c3401b53e1fa303cbecce99 Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Sun, 9 Nov 2025 01:26:12 -0500 Subject: [PATCH] feat: Adds better markdown support / plugins to nvim config. --- env/.config/nvim/after/ftplugin/markdown.lua | 36 +++++++------- env/.config/nvim/init.lua | 51 ++++++++++++++++++-- 2 files changed, 66 insertions(+), 21 deletions(-) diff --git a/env/.config/nvim/after/ftplugin/markdown.lua b/env/.config/nvim/after/ftplugin/markdown.lua index 92290ab..ddf2f5e 100644 --- a/env/.config/nvim/after/ftplugin/markdown.lua +++ b/env/.config/nvim/after/ftplugin/markdown.lua @@ -1,20 +1,20 @@ -- Markdown specific key maps. -- -local todos = require("todo-comments") -local keywords = { "WARN", "WARNING", "IMPORTANT" } - --- Show all the warnings in the quick fix list. -vim.keymap.set( - "n", - "tw", - "Trouble todo toggle filter = {tag = {WARN, IMPORTANT}}", - { desc = "[T]odo [W]arnings" } -) - -vim.keymap.set("n", "]w", function() - todos.jump_next({ keywords = keywords }) -end, { desc = "Next [W]arning" }) - -vim.keymap.set("n", "[w", function() - todos.jump_prev({ keywords = keywords }) -end, { desc = "Previous [W]arning" }) +-- local todos = require("todo-comments") +-- local keywords = { "WARN", "WARNING", "IMPORTANT" } +-- +-- -- Show all the warnings in the quick fix list. +-- vim.keymap.set( +-- "n", +-- "tw", +-- "Trouble todo toggle filter = {tag = {WARN, IMPORTANT}}", +-- { desc = "[T]odo [W]arnings" } +-- ) +-- +-- vim.keymap.set("n", "]w", function() +-- todos.jump_next({ keywords = keywords }) +-- end, { desc = "Next [W]arning" }) +-- +-- vim.keymap.set("n", "[w", function() +-- todos.jump_prev({ keywords = keywords }) +-- end, { desc = "Previous [W]arning" }) diff --git a/env/.config/nvim/init.lua b/env/.config/nvim/init.lua index d93cb5d..a06c2a0 100644 --- a/env/.config/nvim/init.lua +++ b/env/.config/nvim/init.lua @@ -20,14 +20,31 @@ vim.pack.add({ { src = "https://github.com/nvim-mini/mini.pick" }, { src = "https://github.com/stevearc/oil.nvim" }, { src = "https://github.com/neovim/nvim-lspconfig" }, - { src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "main" }, + { src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "main" }, { src = "https://github.com/mason-org/mason.nvim" }, { src = "https://github.com/nvim-lua/plenary.nvim" }, - { src = "https://github.com/ThePrimeagen/harpoon", version = "harpoon2" }, + { src = "https://github.com/ThePrimeagen/harpoon", version = "harpoon2" }, { src = "https://github.com/christoomey/vim-tmux-navigator" }, + { src = "https://github.com/stevearc/conform.nvim" }, + { src = 'https://github.com/MeanderingProgrammer/render-markdown.nvim' }, + }) -require("mason").setup() +require("mason").setup({ + ensure_installed = { + "bash-language-server", + "docker-language-server", + "hyprls", + "jq", + "lua-language-server", + "markdown-toc", + "markdownlint-cli2", + "marksman", + "prettier", + "shellcheck", + "tinymist", + } +}) require("mini.pick").setup() require("oil").setup({ view_options = { @@ -42,6 +59,34 @@ require("oil").setup({ end } }) +require("conform").setup({ + formatters = { + ["markdown-toc"] = { + condition = function(_, ctx) + for _, line in ipairs(vim.api.nvim_buf_get_lines(ctx.buf, 0, -1, false)) do + if line:find("") then + return true + end + end + end, + }, + ["markdownlint-cli2"] = { + condition = function(_, ctx) + local diag = vim.tbl_filter(function(d) + return d.source == "markdownlint" + end, vim.diagnostic.get(ctx.buf)) + return #diag > 0 + end, + }, + formatters_by_ft = { + ["markdown"] = { "prettier", "markdownlint-cli2", "markdown-toc" }, + ["markdown.mdx"] = { "prettier", "markdownlint-cli2", "markdown-toc" }, + lua = { "stulua" }, + swift = { "swiftformat" }, + }, + } +}) + require("harpoon").setup({ settings = { save_on_toggle = true, sync_on_ui_close = true } }) -- Set color scheme