diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 7d802fe..d1954f4 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -2,56 +2,55 @@ "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "LuaSnip": { "branch": "master", "commit": "118263867197a111717b5f13d954cd1ab8124387" }, "ansible-vim": { "branch": "master", "commit": "3329367d2e5f90d203c8d340c53fa83c60a1ad41" }, - "cmp-git": { "branch": "main", "commit": "3d83031c4b63f9b10703e32e070cda0700a81992" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conform.nvim": { "branch": "master", "commit": "eff40c4f5fdf7ae8f269b258047d1bd7cee50f02" }, + "conform.nvim": { "branch": "master", "commit": "c26dadf8a47a547768d1048a0d698ecec33494ce" }, "copilot-cmp": { "branch": "master", "commit": "b6e5286b3d74b04256d0a7e3bd2908eabec34b44" }, "copilot.lua": { "branch": "master", "commit": "86537b286f18783f8b67bccd78a4ef4345679625" }, - "crates.nvim": { "branch": "main", "commit": "1c924d5a9ea3496c4e1a02d0d51388ba809f8468" }, + "crates.nvim": { "branch": "main", "commit": "df9937e1d2352704b0b58087d41da199261f7fc3" }, "dressing.nvim": { "branch": "master", "commit": "6741f1062d3dc6e4755367a7e9b347b553623f04" }, "freeze.nvim": { "branch": "main", "commit": "6460f282b01d4dafd69fbd8d4a38da56572227bc" }, - "friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" }, - "gitsigns.nvim": { "branch": "main", "commit": "562dc47189ad3c8696dbf460d38603a74d544849" }, - "gleam.vim": { "branch": "main", "commit": "ad6c328d6460763ca6a338183f7f1bd54137ce80" }, + "friendly-snippets": { "branch": "main", "commit": "682157939e57bd6a2c86277dfd4d6fbfce63dbac" }, + "gitsigns.nvim": { "branch": "main", "commit": "0595724fa9516a35696ff6b1e3cb95b6462b38b1" }, + "gleam.vim": { "branch": "main", "commit": "f9e82b70425dc0726ee173ecddf176ffa364e30d" }, "gopher.nvim": { "branch": "main", "commit": "f55c15ada8e02398000c04a96ef44d986cd01051" }, "harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" }, - "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, + "lazy.nvim": { "branch": "main", "commit": "37c7163f8d27243993ac07db8477e44cd5275027" }, "lsp-inlayhints.nvim": { "branch": "main", "commit": "d981f65c9ae0b6062176f0accb9c151daeda6f16" }, - "lsp-trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" }, - "lspkind-nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" }, - "lualine.nvim": { "branch": "master", "commit": "544dd1583f9bb27b393f598475c89809c4d5e86b" }, + "lsp-trouble.nvim": { "branch": "main", "commit": "88c3be40c061ce053ab326ce4fdcb973a1f785ff" }, + "lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, + "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, "mini.icons": { "branch": "main", "commit": "fe63fe080e76d80713557e5f0c65bc15b14b152d" }, "mini.indentscope": { "branch": "main", "commit": "f0d7faa064c892b96997810afcddfadc3f2a15b3" }, - "nightfox.nvim": { "branch": "main", "commit": "d3e8b1acc095baf57af81bb5e89fe7c4359eb619" }, - "noice.nvim": { "branch": "main", "commit": "448bb9c524a7601035449210838e374a30153172" }, + "nightfox.nvim": { "branch": "main", "commit": "df75a6a94910ae47854341d6b5a6fd483192c0eb" }, + "noice.nvim": { "branch": "main", "commit": "03c6a75661e68012e30b0ed81f050358b1e2233c" }, "nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" }, "null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" }, - "nvim-autopairs": { "branch": "master", "commit": "6cb23865ba6fe1d3a0f9ccd8d933fbacc1b8e4dd" }, - "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" }, + "nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" }, "nvim-coverage": { "branch": "main", "commit": "aa4b4400588e2259e87e372b1e4e90ae13cf5a39" }, "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" }, "nvim-lint": { "branch": "master", "commit": "efc6fc83f0772283e064c53a8f9fb5645bde0bc0" }, - "nvim-lspconfig": { "branch": "master", "commit": "652386deae739e38fa1bcf2f06e3e7de9b3436ba" }, - "nvim-treesitter": { "branch": "master", "commit": "3e0feeb062b29bb7d6d6df1e32ba28111c2bb734" }, - "nvim-treesitter-context": { "branch": "master", "commit": "0f3332788e0bd37716fbd25f39120dcfd557c90f" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "ca93cb2c34b67ab22d01976fc90bc95627a3317f" }, + "nvim-lspconfig": { "branch": "master", "commit": "1d2454f9fbb34206897b9a1b5e8b87d6418941ba" }, + "nvim-treesitter": { "branch": "master", "commit": "984604288d56265d7cfc443fa9dc9f67ec19d60d" }, + "nvim-treesitter-context": { "branch": "master", "commit": "f2cbd231e296a282aa9aedb2a411539801557307" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, "nvim-ts-rainbow": { "branch": "master", "commit": "8312b513ce930e7669a1721befbe56f2e1853301" }, - "oil.nvim": { "branch": "master", "commit": "fcca212c2e966fc3dec1d4baf888e670631d25d1" }, + "oil.nvim": { "branch": "master", "commit": "65c53dbe4f2140236590a7568a5f22a77d16be39" }, "ollama.nvim": { "branch": "main", "commit": "45e58779fecde7ac5b8f62800bbe7180d4b48507" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, - "rose-pine": { "branch": "main", "commit": "1e45cea06db866143930a6df96fc66bf715c866c" }, - "rustaceanvim": { "branch": "master", "commit": "047f9c9d8cd2861745eb9de6c1570ee0875aa795" }, + "rose-pine": { "branch": "main", "commit": "e10c9c6436556405ec6b187fd459a718f5c55156" }, + "rustaceanvim": { "branch": "master", "commit": "d6d7620b66d74b3b16defcf85cbef7b3582795b3" }, "salt-vim": { "branch": "master", "commit": "6ca9e3500cc39dd417b411435d58a1b720b331cc" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, - "telescope.nvim": { "branch": "master", "commit": "3b1600d0fd5172ad9fae00987362ca0ef3d8895d" }, - "tree-sitter-just": { "branch": "main", "commit": "6648ac1c0cdadaec8ee8bcf9a4ca6ace5102cf21" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, + "telescope.nvim": { "branch": "master", "commit": "7bd2f9b72f8449780b79bcf351534e2cd36ec43a" }, + "tree-sitter-just": { "branch": "main", "commit": "379fbe36d1e441bc9414ea050ad0c85c9d6935ea" }, "undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" }, - "vim-fugitive": { "branch": "master", "commit": "0444df68cd1cdabc7453d6bd84099458327e5513" }, - "vim-just": { "branch": "main", "commit": "907ff68a6f51e220e1544e29d801b570ea6dcab5" }, - "which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" }, - "zig.vim": { "branch": "master", "commit": "ad75bb5752f3556d8bde5b0e69cb69a98058030e" } -} + "vim-fugitive": { "branch": "master", "commit": "d0c1a437536778bcc8174b7cb2ffdf98f611e6fe" }, + "vim-just": { "branch": "main", "commit": "c771fb5f00fd219833600c8164e6befe3c163b9a" }, + "which-key.nvim": { "branch": "main", "commit": "0099511294f16b81c696004fa6a403b0ae61f7a0" }, + "zig.vim": { "branch": "master", "commit": "54c216e5306a5c3878a60596aacb94dca8652ab9" } +} \ No newline at end of file diff --git a/nvim/.config/nvim/lua/mappings.lua b/nvim/.config/nvim/lua/mappings.lua index 05d7028..96f5fc7 100644 --- a/nvim/.config/nvim/lua/mappings.lua +++ b/nvim/.config/nvim/lua/mappings.lua @@ -1,126 +1,31 @@ -- Map leader config vim.cmd.timeoutlen = 0 -local wk = require("which-key") +local function map(mode, l, r, opts) + opts = opts or {} + if type(mode) == "table" then + for _, m in ipairs(mode) do + vim.keymap.set(m, l, r, opts) + end + else + vim.keymap.set(mode, l, r, opts) + end +end +map({ "n", "v" }, "p", '"+p', { desc = "Paste from clipboard" }) +map({ "n", "v" }, "y", '"+y', { desc = "Yank to clipboard" }) +map("n", "gk", vim.diagnostic.goto_prev, { desc = "Go to Prev Diagnostic" }) +map("n", "gj", vim.diagnostic.goto_next, { desc = "Go to Prev Diagnostic" }) +map("t", "", "", { desc = "Exit terminal" }) -- Register LSP mappings vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("UserLspConfig", {}), callback = function(args) - wk.add({ - { "c", group = "LSP Code Changes" }, - { "ca", vim.lsp.buf.code_action, desc = "Code Action" }, - { "R", vim.lsp.buf.rename, desc = "Rename" }, - { "f", group = "LSP Find" }, - { "fl", require("telescope.builtin").lsp_document_symbols, desc = "LSP Document Symbols" }, - { "g", group = "LSP Goto" }, - { "gd", vim.lsp.buf.definition, desc = "Goto Definition" }, - { "gr", require("telescope.builtin").lsp_references, desc = "References" }, - { "gi", require("telescope.builtin").lsp_implementations, desc = "Implementations" }, - { "K", vim.lsp.buf.hover, desc = "Hover (LSP)" }, - }) + map("n", "ca", vim.lsp.buf.code_action, { desc = "Code Action" }) + map("n", "R", vim.lsp.buf.rename, { desc = "Rename" }) + map("n", "fl", require("telescope.builtin").lsp_document_symbols, { desc = "LSP Document Symbols" }) + map("n", "gd", vim.lsp.buf.definition, { desc = "Goto Definition" }) + map("n", "gr", require("telescope.builtin").lsp_references, { desc = "References" }) + map("n", "gi", require("telescope.builtin").lsp_implementations, { desc = "Implementations" }) + map("n", "K", vim.lsp.buf.hover, { desc = "Hover (LSP)" }) end, }) - --- Register Go mappings -vim.api.nvim_create_autocmd("FileType", { - pattern = { "go" }, - group = vim.api.nvim_create_augroup("UserGoConfig", {}), - callback = function() - wk.add({ - { "gt", group = "Go Tags" }, - { "gta", group = "Add Tags" }, - { "gtaj", "GoTagAdd json", desc = "Add JSON tags" }, - { "gtay", "GoTagAdd yaml", desc = "Add YAML tags" }, - { "gtr", group = "Remove Tags" }, - { "gtrj", "GoTagRm json", desc = "Remove JSON tags" }, - { "gtry", "GoTagRm yaml", desc = "Remove YAML tags" }, - }) - end, -}) - -wk.add({ - { "f", group = "Telescope" }, - { "ff", require("telescope.builtin").find_files, desc = "Find File" }, - { "fg", require("telescope.builtin").live_grep, desc = "Live Grep" }, - { "fb", require("telescope.builtin").buffers, desc = "Buffer List" }, - { "fh", require("telescope.builtin").help_tags, desc = "Help Tags" }, - { "fc", require("telescope.builtin").colorscheme, desc = "Colorschme" }, - { "fq", require("telescope").extensions.harpoon.marks, desc = "Harpoon Marks" }, - { "fs", require("telescope.builtin").grep_string, desc = "Grep String" }, - { "g", group = "Git" }, - { "gg", vim.cmd.Git, desc = "Open vim-fugitive" }, - { "gs", group = "Git Stage" }, - { "gsh", require("gitsigns").stage_hunk, desc = "Stage Hunk" }, - { "gsb", require("gitsigns").stage_buffer, desc = "Stage Buffer" }, - { "gb", require("gitsigns").blame_line, desc = "Blame Line" }, - { "p", '"+p', desc = "Paste from clipboard" }, - { "q", require("harpoon.ui").toggle_quick_menu, desc = "Harpoon Quick Menu" }, - { "u", "UndotreeToggle", desc = "UndoTreeToggle" }, - { "s", require("telescope.builtin").spell_suggest, desc = "Spell suggest" }, - { "gk", vim.diagnostic.goto_prev, desc = "Go to Prev Diagnostic" }, - { "gj", vim.diagnostic.goto_next, desc = "Go to Next Diagnostic" }, - { "c", vim.cmd.cclose, desc = "Close qf list" }, - { "", "", desc = "Exit terminal" }, - { "y", '"+y', desc = "Yank to clipboard" }, - { "g", group = "Git" }, - { "gs", group = "Git Stage" }, - { - mode = { "v", "n" }, - { - "gsh", - function() - require("gitsigns").stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) - end, - desc = "Stage Hunk", - }, - { - "gsr", - function() - require("gitsigns").reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) - end, - desc = "Reset Hunk", - }, - { "z", ":Freeze", desc = "Freeze" }, - { "", ":m '>+gv=gv", desc = "Move down selection" }, - { "", ":m '<-2gv=gv", desc = "Move up selection" }, - }, - { - mode = { "t" }, - { "", "", desc = "Exit terminal" }, - }, - { - "1", - function() - require("harpoon.ui").nav_file(1) - end, - desc = "Harpoon 1", - }, - { - "2", - function() - require("harpoon.ui").nav_file(2) - end, - desc = "Harpoon 2", - }, - { - "3", - function() - require("harpoon.ui").nav_file(3) - end, - desc = "Harpoon 3", - }, - { - "4", - function() - require("harpoon.ui").nav_file(4) - end, - desc = "Harpoon 4", - }, - { - "5", - function() - require("harpoon.ui").nav_file(5) - end, - desc = "Harpoon 5", - }, -}) diff --git a/nvim/.config/nvim/lua/plugins/git.lua b/nvim/.config/nvim/lua/plugins/git.lua index f9e5500..3e00786 100644 --- a/nvim/.config/nvim/lua/plugins/git.lua +++ b/nvim/.config/nvim/lua/plugins/git.lua @@ -3,10 +3,37 @@ return { { "tpope/vim-fugitive", cmd = "Git", + keys = { + { "gg", vim.cmd.Git, desc = "Open vim-fugitive" }, + }, }, { "lewis6991/gitsigns.nvim", + lazy = true, event = "BufReadPre", - config = true, + opts = { + on_attach = function(bufnr) + local signs = require("gitsigns") + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + if type(mode) == "table" then + for _, m in ipairs(mode) do + vim.keymap.set(m, l, r, opts) + end + else + vim.keymap.set(mode, l, r, opts) + end + end + map({ "v", "n" }, "gsh", function() + signs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end) + map("n", "gsb", signs.stage_buffer) + map({ "v", "n" }, "gsr", function() + require("gitsigns").reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end) + map("n", "gb", signs.blame_line) + end, + }, }, } diff --git a/nvim/.config/nvim/lua/plugins/harpoon.lua b/nvim/.config/nvim/lua/plugins/harpoon.lua index da3deae..d12f60b 100644 --- a/nvim/.config/nvim/lua/plugins/harpoon.lua +++ b/nvim/.config/nvim/lua/plugins/harpoon.lua @@ -15,6 +15,48 @@ return { end, desc = "Harpoon Mark", }, + { + "q", + function() + require("harpoon.ui").toggle_quick_menu() + end, + desc = "Harpoon Quick Menu", + }, + { + "1", + function() + require("harpoon.ui").nav_file(1) + end, + desc = "Harpoon 1", + }, + { + "2", + function() + require("harpoon.ui").nav_file(2) + end, + desc = "Harpoon 2", + }, + { + "3", + function() + require("harpoon.ui").nav_file(3) + end, + desc = "Harpoon 3", + }, + { + "4", + function() + require("harpoon.ui").nav_file(4) + end, + desc = "Harpoon 4", + }, + { + "5", + function() + require("harpoon.ui").nav_file(5) + end, + desc = "Harpoon 5", + }, }, }, } diff --git a/nvim/.config/nvim/lua/plugins/telescope.lua b/nvim/.config/nvim/lua/plugins/telescope.lua index 1207ef2..dff22fe 100644 --- a/nvim/.config/nvim/lua/plugins/telescope.lua +++ b/nvim/.config/nvim/lua/plugins/telescope.lua @@ -10,7 +10,18 @@ return { require("telescope").load_extension("fzf") require("telescope").load_extension("harpoon") end, + lazy = true, + keys = { + { "ff", require("telescope.builtin").find_files, desc = "Find File" }, + { "fg", require("telescope.builtin").live_grep, desc = "Live Grep" }, + { "fb", require("telescope.builtin").buffers, desc = "Buffer List" }, + { "fh", require("telescope.builtin").help_tags, desc = "Help Tags" }, + { "fc", require("telescope.builtin").colorscheme, desc = "Colorschme" }, + { "fq", require("telescope").extensions.harpoon.marks, desc = "Harpoon Marks" }, + { "fs", require("telescope.builtin").grep_string, desc = "Grep String" }, + { "s", require("telescope.builtin").spell_suggest, desc = "Spell suggest" }, + }, }, { "nvim-telescope/telescope-fzf-native.nvim",