diff --git a/lazy-lock.json b/lazy-lock.json index 3e182a6..0bc0b7d 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,60 +1,60 @@ { "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, - "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, + "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, - "blink.cmp": { "branch": "main", "commit": "dcda20d3aa345025699a920c45b0a0603551f41d" }, + "blink.cmp": { "branch": "main", "commit": "1c8d8e45d6fba3d11512f4762b1fdf906bffca42" }, "chezmoi.nvim": { "branch": "main", "commit": "3f72cffa2d18aaec884502443bae37226f3decd2" }, "chezmoi.vim": { "branch": "main", "commit": "abf37336437867cbd99ce2f8849b717415391cc3" }, "cloak.nvim": { "branch": "main", "commit": "648aca6d33ec011dc3166e7af3b38820d01a71e4" }, "codeium.vim": { "branch": "main", "commit": "000de972de76f357c03da14f4f8dd9a969d4fe8c" }, - "conform.nvim": { "branch": "master", "commit": "db8a4a9edb217067b1d7a2e0362c74bfe9cc944d" }, + "conform.nvim": { "branch": "master", "commit": "f9ef25a7ef00267b7d13bfc00b0dea22d78702d5" }, "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, - "ecolog.nvim": { "branch": "main", "commit": "ba6fe51a53a0c5f9cb3c5c33008ff77bb653a090" }, + "ecolog.nvim": { "branch": "main", "commit": "edbb4f204ea1bd13e5b2c5431951df57371bb073" }, "flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "fzf-lua": { "branch": "main", "commit": "d40d2e7225a18fb3bbb7b9be38c51876d652741d" }, + "fzf-lua": { "branch": "main", "commit": "aeff8132009a7fc55c6c43bca4288d5ba26a5393" }, "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, - "gitsigns.nvim": { "branch": "main", "commit": "4c40357994f386e72be92a46f41fc1664c84c87d" }, - "go.nvim": { "branch": "master", "commit": "6ad080424f4b96a584cf591721e8e13c102cce4e" }, + "gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" }, + "go.nvim": { "branch": "master", "commit": "f058a8c622edf24d27b8ef82fabffdbbc1d55707" }, "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" }, - "indent-blankline.nvim": { "branch": "master", "commit": "e10626f7fcd51ccd56d7ffc00883ba7e0aa28f78" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "knap": { "branch": "main", "commit": "7db44d0bb760120142cc1e8f43e44976de59c2f6" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, "lspsaga.nvim": { "branch": "main", "commit": "6063935cf68de9aa6dd79f8e1caf5df0a9385de3" }, - "lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" }, + "lualine.nvim": { "branch": "master", "commit": "9fef261b53fbe3a2ef01ee9667f6fde064b1ed10" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, - "mini.ai": { "branch": "main", "commit": "6e01c0e5a15554852546fac9853960780ac52ed4" }, + "mini.ai": { "branch": "main", "commit": "978ffc65c6b513fde9ef075326d34d89197f1ea5" }, "mini.icons": { "branch": "main", "commit": "ec61af6e606fc89ee3b1d8f2f20166a3ca917a36" }, - "mini.nvim": { "branch": "main", "commit": "0a9259e95dbfcd07d5d506c56afd615e018acc4e" }, - "mini.surround": { "branch": "main", "commit": "f90069c7441a5fb04c3de42eacf93e16b64dd3eb" }, + "mini.surround": { "branch": "main", "commit": "c92d262deae79545b7674b2069332116461a85f3" }, "neoscroll.nvim": { "branch": "master", "commit": "f957373912e88579e26fdaea4735450ff2ef5c9c" }, "nightfox.nvim": { "branch": "main", "commit": "ba47d4b4c5ec308718641ba7402c143836f35aa9" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, "nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" }, - "nvim-lint": { "branch": "master", "commit": "6e9dd545a1af204c4022a8fcd99727ea41ffdcc8" }, - "nvim-lspconfig": { "branch": "master", "commit": "fd26f8626c03b424f7140d454031d1dcb8d23513" }, + "nvim-lint": { "branch": "master", "commit": "936197073214c26a347fb933c9459c8766376b23" }, + "nvim-lspconfig": { "branch": "master", "commit": "699cf2ce74e40e7c5068cf93a6bd6a74b24c5ec3" }, "nvim-spectre": { "branch": "master", "commit": "ddd7383e856a7c939cb4f5143278fe041bbb8cb9" }, - "nvim-treesitter": { "branch": "master", "commit": "59573f96164ab3725a2358fe8ffe69e8291d9549" }, + "nvim-treesitter": { "branch": "master", "commit": "ff553df2f4c5641be2b282e1a0a072c46cf03591" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, "nvim-vtsls": { "branch": "main", "commit": "45c6dfea9f83a126e9bfc5dd63430562b3f8af16" }, - "oil.nvim": { "branch": "master", "commit": "548587d68b55e632d8a69c92cefd981f360634fa" }, + "oil.nvim": { "branch": "master", "commit": "4c9bdf0d839932617cdb25ed46a2f7bb1e090f77" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "pretty-fold.nvim": { "branch": "master", "commit": "1eb18f228972e86b7b8f5ef33ca8091e53fb1e49" }, - "render-markdown.nvim": { "branch": "main", "commit": "81374ffd26f9a9d5f44274a9e7e60547b5fd106f" }, - "rose-pine": { "branch": "main", "commit": "91548dca53b36dbb9d36c10f114385f759731be1" }, - "schemastore.nvim": { "branch": "main", "commit": "c183ec0ee5847642f3e8a2de881fc9cfebec1536" }, + "render-markdown.nvim": { "branch": "main", "commit": "62d6681332365cfddbe916c888752834d9f7ad0c" }, + "schemastore.nvim": { "branch": "main", "commit": "a0df1a2a9c960b677bf2dd1610b434fca045056d" }, "suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, "ts-error-translator.nvim": { "branch": "main", "commit": "47e5ba89f71b9e6c72eaaaaa519dd59bd6897df4" }, - "undotree": { "branch": "master", "commit": "76c4e32d8f1aa493bb68d4a3fcd3c700395c303c" }, + "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, "vim-dadbod": { "branch": "master", "commit": "9f0ca8bcef704659820a95c3bbd2c262583a66a1" }, - "vim-dadbod-completion": { "branch": "master", "commit": "3f5783c12e184e4b6f05dfcbd7c1a6da05b4d66e" }, + "vim-dadbod-completion": { "branch": "master", "commit": "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6" }, "vim-dadbod-ui": { "branch": "master", "commit": "f4d37b7312ae6489e5c04bee654ca521baac188a" }, + "vim-hugo": { "branch": "master", "commit": "324fb8c7371d31701349c1192e25a0bdcf9898f8" }, "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } } diff --git a/lua/plugins/completion.lua b/lua/plugins/completion.lua index 1e2b45b..e9b60c4 100644 --- a/lua/plugins/completion.lua +++ b/lua/plugins/completion.lua @@ -1,6 +1,6 @@ local M = { "saghen/blink.cmp", - dependencies = "rafamadriz/friendly-snippets", + dependencies = { "L3MON4D3/LuaSnip", version = "v2.*" }, version = "v0.*", } @@ -25,6 +25,8 @@ M.config = function() nerd_font_variant = "mono", }, + snippets = { preset = "luasnip" }, + sources = { default = { "lsp", "path", "snippets", "buffer", "dadbod" }, providers = { diff --git a/lua/plugins/format.lua b/lua/plugins/format.lua index db78f7b..24de3e2 100644 --- a/lua/plugins/format.lua +++ b/lua/plugins/format.lua @@ -24,6 +24,9 @@ return { c = { "clang-format" }, cpp = { "clang-format" }, hcl = { "hcl" }, + toml = { "taplo" }, + htmlhugo = { "prettier" }, + markdown = { "prettier" }, }, formatters = { csharpier = { @@ -38,5 +41,11 @@ return { }, notify_on_error = false, }) + vim.api.nvim_set_keymap( + "n", + "cf", + 'lua require("conform").format()', + { noremap = true, silent = true } + ) end, } diff --git a/lua/plugins/fzf.lua b/lua/plugins/fzf.lua index 9bbe32a..580a527 100644 --- a/lua/plugins/fzf.lua +++ b/lua/plugins/fzf.lua @@ -47,6 +47,7 @@ M.config = function() "dist", "build", "coverage", + "public", } local exclude_opts = "" diff --git a/lua/plugins/hugo.lua b/lua/plugins/hugo.lua new file mode 100644 index 0000000..56483f5 --- /dev/null +++ b/lua/plugins/hugo.lua @@ -0,0 +1,103 @@ +local M = { + "phelipetls/vim-hugo", +} + +M.config = function() + local function is_hugo_project() + local config_files = { "hugo.toml", "hugo.yaml", "hugo.json" } + for _, file in ipairs(config_files) do + if vim.fn.glob(file) ~= "" then + return true + end + end + return false + end + + local function get_archetypes() + local kinds = {} + local archetype_paths = { + "archetypes/", + "themes/*/archetypes/", + } + + for _, path in ipairs(archetype_paths) do + local files = vim.fn.glob(path .. "*.md", false, true) + for _, file in ipairs(files) do + local kind = vim.fn.fnamemodify(file, ":t:r") + table.insert(kinds, kind) + end + end + return kinds + end + + local function get_content_completions(lead) + local search_path = lead:match("^content/") and lead or "content/" .. lead + local matches = vim.fn.glob("content/**/*", false, true) + + local completions = {} + for _, match in ipairs(matches) do + local display = match:gsub("^content/", "") + if match:match("^" .. vim.pesc(search_path)) then + if vim.fn.isdirectory(match) == 2 then + display = display .. "/" + end + table.insert(completions, display) + end + end + + return completions + end + + local function run_hugo_command(args) + local cmd = "hugo " .. table.concat(args, " ") + vim.cmd("!" .. cmd) + end + + local function hugo_complete_arglead(lead, cmd_line, _) + cmd_line = cmd_line:gsub("%s+", " ") + + local parts = vim.split(cmd_line, " ") + + local basic_subcommands = { + "server", + "new", + "help", + "version", + "config", + } + + if #parts <= 2 then + return vim.tbl_filter(function(sub) + return sub:match("^" .. vim.pesc(lead or "")) + end, basic_subcommands) + end + + if parts[2] == "new" then + if #parts == 3 then + return { "content" } + end + + if parts[3] == "content" then + -- If the previous part is -k or --kind + if parts[#parts - 1] == "-k" or parts[#parts - 1] == "--kind" then + return get_archetypes() + end + + return get_content_completions(lead) + end + end + + return {} + end + + if is_hugo_project() then + vim.api.nvim_create_user_command("Hugo", function(opts) + run_hugo_command(opts.fargs) + end, { + nargs = "*", + complete = hugo_complete_arglead, + }) + end +end + +return M diff --git a/lua/plugins/knap.lua b/lua/plugins/knap.lua new file mode 100644 index 0000000..933ceda --- /dev/null +++ b/lua/plugins/knap.lua @@ -0,0 +1,26 @@ +return { + { + "frabjous/knap", + lazy = false, + config = function() + -- Configure KNAP settings + vim.g.knap_settings = { + mdoutputext = "pdf", + mdtopdf = "pandoc -o %outputfile% --pdf-engine=xelatex", + mdtopdfviewerlaunch = "zathura %outputfile%", + mdtopdfviewerrefresh = "none", + mdtopdfbufferasstdin = true, + } + + -- Set up keymappings for all markdown files + vim.api.nvim_create_autocmd("FileType", { + pattern = { "markdown", "pandoc", "md" }, + callback = function() + vim.keymap.set("n", "kt", function() + require("knap").toggle_autopreviewing() + end, { buffer = true, desc = "KNAP toggle auto-preview" }) + end, + }) + end, + }, +} diff --git a/lua/plugins/markdown.lua b/lua/plugins/markdown.lua index 292431f..91fbcb0 100644 --- a/lua/plugins/markdown.lua +++ b/lua/plugins/markdown.lua @@ -10,7 +10,7 @@ local M = { }, { "MeanderingProgrammer/render-markdown.nvim", - dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.nvim" }, -- if you use the mini.nvim suite + dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.icons" }, -- if you use the mini.nvim suite opts = {}, }, } diff --git a/lua/plugins/snips.lua b/lua/plugins/snips.lua index 930e81f..440809b 100644 --- a/lua/plugins/snips.lua +++ b/lua/plugins/snips.lua @@ -1,20 +1,59 @@ local M = { - "L3MON4D3/LuaSnip", + version = "v2.*", + build = "make install_jsregexp", dependencies = { "rafamadriz/friendly-snippets", - -- "saadparwaiz1/cmp_luasnip", }, - build = "make install_jsregexp", } M.config = function() + local ls = require("luasnip") + local s = ls.snippet + local t = ls.text_node + local i = ls.insert_node + + ls.setup({ + history = true, -- Allow jumping back into snippets + update_events = "TextChanged,TextChangedI", -- Update snippets as you type + + -- Make sure LuaSnip works well with blink.cmp + region_check_events = "CursorMoved,CursorHold,InsertEnter", + delete_check_events = "TextChanged,InsertLeave", + }) + + -- Markdown code block snippets with multiple language support + local code_block_langs = { + bash = "bash", + go = "go", + python = "python", + javascript = "javascript", + typescript = "typescript", + rust = "rust", + lua = "lua", + cpp = "cpp", + json = "json", + html = "html", + css = "css", + } + + local code_block_snippets = {} + for trigger, lang in pairs(code_block_langs) do + table.insert( + code_block_snippets, + s({ trig = "`" .. trigger, regTrig = false, snippetType = "autosnippet" }, { + t({ "", "```" .. lang }), + t({ "", "" }), + i(1, "# your " .. lang .. " code here"), + t({ "", "```" }), + }) + ) + end + + ls.add_snippets("markdown", code_block_snippets) + require("luasnip.loaders.from_vscode").lazy_load() require("luasnip.loaders.from_vscode").lazy_load({ paths = vim.fn.stdpath("config") .. "/lua/plugins/snippets/" }) - require("luasnip").config.set_config({ - history = true, - updateevents = "TextChanged,TextChangedI", - }) end return M diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 9995963..4401a3b 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -3,7 +3,18 @@ return { build = ":TSUpdate", config = function() require("nvim-treesitter.configs").setup({ - ensure_installed = { "c", "lua", "typescript", "go", "vim", "vimdoc", "query", "markdown", "markdown_inline" }, + ensure_installed = { + "c", + "lua", + "typescript", + "go", + "vim", + "vimdoc", + "query", + "markdown", + "markdown_inline", + "templ", + }, ignore_install = {}, modules = {}, sync_install = false,