diff --git a/lazy-lock.json b/lazy-lock.json index fa135bb..737bf7c 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,31 +1,31 @@ { "LuaSnip": { "branch": "master", "commit": "de10d8414235b0a8cabfeba60d07c24304e71f5c" }, - "NvChad": { "branch": "v2.5", "commit": "29ebe31ea6a4edf351968c76a93285e6e108ea08" }, + "NvChad": { "branch": "v2.5", "commit": "d042cc975247c2aa55fcb228e5d146dc1dc6c648" }, "base46": { "branch": "v2.5", "commit": "fde7a2cd54599e148d376f82980407c2d24b0fa2" }, - "cmp-async-path": { "branch": "main", "commit": "0ed1492f59e730c366d261a5ad822fa37e44c325" }, + "cmp-async-path": { "branch": "main", "commit": "f8af3f726e07f2e9d37672eaa9102581aefce149" }, "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, - "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, + "cmp-nvim-lua": { "branch": "main", "commit": "e3a22cb071eb9d6508a156306b102c45cd2d573d" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" }, - "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "gitsigns.nvim": { "branch": "main", "commit": "8270378ab83540b03d09c0194ba3e208f9d0cb72" }, - "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, - "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "mason.nvim": { "branch": "main", "commit": "9e25c98d4826998460926f8c5c2284848d80ae89" }, + "conform.nvim": { "branch": "master", "commit": "dca1a190aa85f9065979ef35802fb77131911106" }, + "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, + "gitsigns.nvim": { "branch": "main", "commit": "6d808f99bd63303646794406e270bd553ad7792e" }, + "indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "mason.nvim": { "branch": "main", "commit": "cb8445f8ce85d957416c106b780efd51c6298f89" }, "menu": { "branch": "main", "commit": "7a0a4a2896b715c066cfbe320bdc048091874cc6" }, "minty": { "branch": "main", "commit": "aafc9e8e0afe6bf57580858a2849578d8d8db9e0" }, - "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, - "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, - "nvim-lspconfig": { "branch": "master", "commit": "63a38440989c58e1f100373ab603fd24665bdc9a" }, - "nvim-tree.lua": { "branch": "master", "commit": "9a05b9e9f928856ca23dbf876fab372003180c3f" }, - "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-web-devicons": { "branch": "master", "commit": "3362099de3368aa620a8105b19ed04c2053e38c0" }, + "nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" }, + "nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" }, + "nvim-lspconfig": { "branch": "master", "commit": "31026a13eefb20681124706a79fc1df6bf11ab27" }, + "nvim-tree.lua": { "branch": "master", "commit": "f9bfc0059eca24546b69a7006110463da4808f8f" }, + "nvim-treesitter": { "branch": "master", "commit": "cf12346a3414fa1b06af75c79faebe7f76df080a" }, + "nvim-web-devicons": { "branch": "master", "commit": "4fc505ac7bd7692824a142e96e5f529c133862f8" }, "obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" }, - "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, - "transparent.nvim": { "branch": "main", "commit": "8a2749a2fa74f97fe6557f61b89ac7fd873f3c21" }, - "ui": { "branch": "v3.0", "commit": "dc4950f5bd4117e2da108b681506c908b93d4a62" }, - "volt": { "branch": "main", "commit": "7b8c5e790120d9f08c8487dcb80692db6d2087a1" }, - "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } + "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, + "telescope.nvim": { "branch": "master", "commit": "506338434fec5ad19cb1f8d45bf92d66c4917393" }, + "transparent.nvim": { "branch": "main", "commit": "8ac59883de84e9cd1850ea25cf087031c5ba7d54" }, + "ui": { "branch": "v3.0", "commit": "cb75908a86720172594b30de147272c1b3a7f452" }, + "volt": { "branch": "main", "commit": "620de1321f275ec9d80028c68d1b88b409c0c8b1" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } } diff --git a/lua/chadrc.lua b/lua/chadrc.lua index 520be16..6f6a16e 100644 --- a/lua/chadrc.lua +++ b/lua/chadrc.lua @@ -6,7 +6,7 @@ local M = {} M.base46 = { - theme = "vscode_dark", + theme = "github_dark", -- hl_override = { -- Comment = { italic = true }, diff --git a/lua/configs/conform.lua b/lua/configs/conform.lua index 4d441e1..dc229e4 100644 --- a/lua/configs/conform.lua +++ b/lua/configs/conform.lua @@ -14,6 +14,10 @@ local options = { args = { "-l", "postgresql" }, stdin = true, }, + mdformat = { + command = vim.fn.stdpath("data") .. "/mason/bin/mdformat", + stdin = true, + }, }, } diff --git a/lua/mappings.lua b/lua/mappings.lua index 3131eea..ebd55e1 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -61,6 +61,11 @@ end, { desc = "Wrap selected text in double quotes" }) -- Gitsigns blame current line vim.keymap.set("n", "gb", ":Gitsigns blame_line", { noremap = true, silent = true, desc = "Git blame line" }) +-- Format current buffer (uses conform; for markdown this snaps tables via mdformat-gfm) +vim.keymap.set({ "n", "v" }, "fm", function() + require("conform").format({ async = true, lsp_fallback = true }) +end, { desc = "Format buffer / selection" }) + -- Disable alt+h and alt+v terminal toggles vim.keymap.del({ "n", "t" }, "") vim.keymap.del({ "n", "t" }, "") diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 4188b85..7dea79a 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -81,8 +81,36 @@ return { { "williamboman/mason.nvim", cmd = { "Mason", "MasonInstall", "MasonUpdate" }, + -- run on startup so a fresh-clone install pulls the tools below automatically + lazy = false, config = function() require("mason").setup() + local registry = require("mason-registry") + local ensure = { "stylua", "sql-formatter", "mdformat" } + + -- Mason's `mdformat` ships without plugins; we need mdformat-gfm for + -- table-snapping. Pip-installs into Mason's mdformat venv if missing. + local function ensure_mdformat_gfm() + local venv = vim.fn.stdpath("data") .. "/mason/packages/mdformat/venv" + local pip = venv .. "/bin/pip" + if vim.fn.executable(pip) == 0 then return end + vim.fn.system({ pip, "show", "mdformat-gfm" }) + if vim.v.shell_error ~= 0 then + vim.fn.system({ pip, "install", "--quiet", "mdformat-gfm" }) + end + end + + registry.refresh(function() + for _, name in ipairs(ensure) do + local ok, pkg = pcall(registry.get_package, name) + if ok and not pkg:is_installed() then + pkg:install():once("closed", function() + if name == "mdformat" then vim.schedule(ensure_mdformat_gfm) end + end) + end + end + vim.schedule(ensure_mdformat_gfm) + end) end, }, -- {