From 867159343ac3041f3f809c3813aa8d48faab5957 Mon Sep 17 00:00:00 2001 From: "Mariano Z." Date: Fri, 28 Mar 2025 20:33:57 -0300 Subject: [PATCH] chore: back to fugitive --- init.lua | 14 +++++++ lazy-lock.json | 24 +++++------ lua/plugins/ai.lua | 35 ++++++---------- lua/plugins/chezmoi.lua | 64 +++++++++++++----------------- lua/plugins/completion.lua | 2 +- lua/plugins/git.lua | 41 ++++++++++++++++++- lua/plugins/harpoon.lua | 34 ---------------- lua/plugins/lsp/extras/context.lua | 15 ------- lua/plugins/lsp/init.lua | 1 - lua/plugins/presenterm.lua | 7 ++-- 10 files changed, 107 insertions(+), 130 deletions(-) delete mode 100644 lua/plugins/harpoon.lua delete mode 100644 lua/plugins/lsp/extras/context.lua diff --git a/init.lua b/init.lua index a1fc44e..c73ee61 100644 --- a/init.lua +++ b/init.lua @@ -3,3 +3,17 @@ require("config.options") require("config.remap") require("config.autocomands") require("config.lazy") + +vim.api.nvim_create_autocmd("VimEnter", { + callback = function() + local config_path = vim.fn.stdpath("config") + local current_dir = vim.fn.getcwd() + if current_dir == config_path then + vim.fn.system("git config core.hooksPath .githooks") + if vim.v.shell_error ~= 0 then + vim.notify("Failed to set git hooks path for Neovim config", vim.log.levels.WARN) + end + end + end, + desc = "Set git hooks path for Neovim config directory only", +}) diff --git a/lazy-lock.json b/lazy-lock.json index 56d2467..3c48a55 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -4,30 +4,27 @@ "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, "blink.cmp": { "branch": "main", "commit": "49f211fe5d729df53df4c042d7c3464cf47d199e" }, "chezmoi.nvim": { "branch": "main", "commit": "3f72cffa2d18aaec884502443bae37226f3decd2" }, - "chezmoi.vim": { "branch": "main", "commit": "abf37336437867cbd99ce2f8849b717415391cc3" }, "cloak.nvim": { "branch": "main", "commit": "648aca6d33ec011dc3166e7af3b38820d01a71e4" }, - "conform.nvim": { "branch": "master", "commit": "f9ef25a7ef00267b7d13bfc00b0dea22d78702d5" }, + "codeium.vim": { "branch": "main", "commit": "000de972de76f357c03da14f4f8dd9a969d4fe8c" }, + "conform.nvim": { "branch": "master", "commit": "b1a75324ddf96b7bb84963a297b1ed334db087c0" }, "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "fzf-lua": { "branch": "main", "commit": "89ff12300e9a768f4890a8e02bb6a3f5d97f9a65" }, + "fzf-lua": { "branch": "main", "commit": "caee13203d6143d691710c34f85ad6441fe3f535" }, "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, - "gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" }, + "gitsigns.nvim": { "branch": "main", "commit": "3c76f7fabac723aa682365ef782f88a83ccdb4ac" }, "go.nvim": { "branch": "master", "commit": "0d426e87227dd14584881ecc595c173121456111" }, - "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" }, "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": "778d56ff9b387dacd14ae648ed5604394b486f51" }, "lualine.nvim": { "branch": "master", "commit": "1517caa8fff05e4b4999857319d3b0609a7f57fa" }, "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": "978ffc65c6b513fde9ef075326d34d89197f1ea5" }, "mini.icons": { "branch": "main", "commit": "86a633f0dffcfd80110bac86681dbf4b5c37ba5c" }, - "mini.surround": { "branch": "main", "commit": "c92d262deae79545b7674b2069332116461a85f3" }, - "neocodeium": { "branch": "main", "commit": "8a0b9b872b7da673ad2f6f1c3d17ac5c338053a8" }, + "mini.surround": { "branch": "main", "commit": "97796f68a8698d9b63ac3927da0d0bf5c3a0876b" }, "neoscroll.nvim": { "branch": "master", "commit": "f957373912e88579e26fdaea4735450ff2ef5c9c" }, "nightfox.nvim": { "branch": "main", "commit": "ba47d4b4c5ec308718641ba7402c143836f35aa9" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, @@ -35,20 +32,19 @@ "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" }, "nvim-lint": { "branch": "master", "commit": "93b8040115c9114dac1047311763bef275e752dc" }, - "nvim-lspconfig": { "branch": "master", "commit": "85e0dd26b710e834a105d679200d01e326a3d2b0" }, + "nvim-lspconfig": { "branch": "master", "commit": "ff6471d4f837354d8257dfa326b031dd8858b16e" }, "nvim-spectre": { "branch": "master", "commit": "ddd7383e856a7c939cb4f5143278fe041bbb8cb9" }, - "nvim-treesitter": { "branch": "master", "commit": "a3315b8c7f0f1ddaa30b24bcc0af0d31024dfb6a" }, + "nvim-treesitter": { "branch": "master", "commit": "9be6836ebeb88a536055bf1ce0961eef68da4bc6" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, - "oil.nvim": { "branch": "master", "commit": "ab887d926c2665a708fbe9e6c4654042cc5f4c60" }, + "oil.nvim": { "branch": "master", "commit": "302bbaceeafc690e6419e0c8296e804d60cb9446" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, - "presenterm.nvim": { "branch": "main", "commit": "f85ac3ab84ba12689858b6565236ebf5e835c09d" }, "pretty-fold.nvim": { "branch": "master", "commit": "1eb18f228972e86b7b8f5ef33ca8091e53fb1e49" }, - "render-markdown.nvim": { "branch": "main", "commit": "a1fc4e559252baa128c471adadf0be045abd542d" }, + "render-markdown.nvim": { "branch": "main", "commit": "a020c88e9552b50916a78dec9eeb4656c6391e6d" }, "schemastore.nvim": { "branch": "main", "commit": "e659e0c6ca06727ed898aaaeea3850f528898684" }, "suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, - "typescript-tools.nvim": { "branch": "master", "commit": "3bc72c8597f6137f977032f5c76fcde51e0ef19a" }, + "typescript-tools.nvim": { "branch": "master", "commit": "e0887c1e336edbb01243e9f1e60d74b0bc0a2bed" }, "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, "vim-dadbod": { "branch": "master", "commit": "9f0ca8bcef704659820a95c3bbd2c262583a66a1" }, "vim-dadbod-completion": { "branch": "master", "commit": "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6" }, diff --git a/lua/plugins/ai.lua b/lua/plugins/ai.lua index 7adf387..2c0139d 100644 --- a/lua/plugins/ai.lua +++ b/lua/plugins/ai.lua @@ -1,40 +1,29 @@ local M = { - "monkoose/neocodeium", - cmd = "NeoCodeium", + "Exafunction/codeium.vim", + cmd = "Codeium", keys = { - { "ce", "NeoCodeium toggle", desc = "Codeium Enable" }, + { "ce", "Codeium Toggle", desc = "Codeium Enable" }, }, } M.config = function() - local neocodeium = require("neocodeium") - local blink = require("blink.cmp") - neocodeium.setup() - - vim.api.nvim_create_autocmd("User", { - pattern = "BlinkCmpMenuOpen", - callback = function() - neocodeium.clear() - end, - }) - - neocodeium.setup({ - filter = function() - return not blink.is_visible() - end, - }) - vim.g.codeium_disable_bindings = 1 - imap("", neocodeium.accept, { expr = true, silent = true, desc = "[codeium] Accept completion" }) + imap("", function() + return vim.fn["codeium#Accept"]() + end, { expr = true, silent = true, desc = "[codeium] Accept completion" }) imap("", function() - return neocodeium.cycle(1) + return vim.fn["codeium#CycleCompletions"](1) end, { expr = true, silent = true, desc = "[codeium] Cycle completions" }) imap("", function() - return neocodeium.cycle(-1) + return vim.fn["codeium#CycleCompletions"](-1) end, { expr = true, silent = true, desc = "[codeium] Cycle completions" }) + + imap("", function() + return vim.fn["codeium#Clear"]() + end, { expr = true, silent = true, desc = "[codeium] Clear" }) end return M diff --git a/lua/plugins/chezmoi.lua b/lua/plugins/chezmoi.lua index aa7f642..824ecf3 100644 --- a/lua/plugins/chezmoi.lua +++ b/lua/plugins/chezmoi.lua @@ -1,41 +1,31 @@ return { - { - "alker0/chezmoi.vim", - lazy = false, - init = function() - -- This option is required. - vim.g["chezmoi#use_tmp_buffer"] = true - end, - }, - { - "xvzc/chezmoi.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - config = function() - require("chezmoi").setup({ - -- your configurations - edit = { - watch = true, -- Set true to automatically apply on save. - force = true, -- Set true to force apply. Works only when watch = true. - }, - notification = { - on_open = true, -- vim.notify when start editing chezmoi-managed file. - on_apply = true, -- vim.notify on apply. - }, - }) + "xvzc/chezmoi.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + require("chezmoi").setup({ + -- your configurations + edit = { + watch = true, -- Set true to automatically apply on save. + force = true, -- Set true to force apply. Works only when watch = true. + }, + notification = { + on_open = true, -- vim.notify when start editing chezmoi-managed file. + on_apply = true, -- vim.notify on apply. + }, + }) - vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { - pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" }, - callback = function() - -- invoke with vim.schedule() for better startup time - vim.schedule(require("chezmoi.commands.__edit").watch) - end, - }) + vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" }, + callback = function() + -- invoke with vim.schedule() for better startup time + vim.schedule(require("chezmoi.commands.__edit").watch) + end, + }) - -- Auto-apply chezmoi changes - vim.api.nvim_create_autocmd("BufWritePost", { - pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" }, - command = [[silent! !chezmoi apply --source-path "%"]], - }) - end, - }, + -- Auto-apply chezmoi changes + vim.api.nvim_create_autocmd("BufWritePost", { + pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" }, + command = [[silent! !chezmoi apply --source-path "%"]], + }) + end, } diff --git a/lua/plugins/completion.lua b/lua/plugins/completion.lua index 16af33f..997686b 100644 --- a/lua/plugins/completion.lua +++ b/lua/plugins/completion.lua @@ -1,6 +1,7 @@ local M = { "saghen/blink.cmp", dependencies = { "L3MON4D3/LuaSnip", version = "v2.*" }, + version = "v1.*", } @@ -18,7 +19,6 @@ M.config = function() [""] = { "select_prev", "fallback" }, [""] = { "select_next", "fallback" }, - [""] = { "fallback" }, }, appearance = { diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index 8603322..68ff337 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -2,10 +2,47 @@ local M = { { "tpope/vim-fugitive", config = function() - print("Magic") - -- For init.lua + local git_status = function() + local bufnr = vim.api.nvim_get_current_buf() + if vim.b[bufnr].fugitive_status then + local winnr = vim.fn.bufwinid(bufnr) + vim.api.nvim_win_close(winnr, true) + else + vim.cmd("G") + end + end + vim.g.fugitive_git_executable = "env GPG_TTY=$(tty) git" vim.env.GPG_TTY = vim.fn.system("tty"):gsub("\n", "") + + nmap("lg", ":G", { desc = "Git Status" }) + nmap("gs", git_status, { desc = "Toggle Git Status" }) + nmap("gs", git_status, { desc = "Toggle Git Status" }) + + vim.api.nvim_create_autocmd("FileType", { + pattern = { "fugitive", "fugitiveblame", "fugitive-status" }, + callback = function() + nmap("P", function() + local cmd = "git push --force-with-lease" + vim.notify("Pushing...", vim.log.levels.INFO) + vim.fn.jobstart(cmd, { + on_exit = function(_, code) + if code == 0 then + vim.notify("Push completed successfully", vim.log.levels.INFO) + else + vim.notify("Push failed with exit code: " .. code, vim.log.levels.ERROR) + end + end, + detach = true, + }) + end, { buffer = true, desc = "Git Push Force With Lease (Async)" }) + + nmap("", function() + local win_id = vim.api.nvim_get_current_win() + vim.api.nvim_win_close(win_id, false) + end, { buffer = true, desc = "Close window" }) + end, + }) end, }, { diff --git a/lua/plugins/harpoon.lua b/lua/plugins/harpoon.lua deleted file mode 100644 index 4719f92..0000000 --- a/lua/plugins/harpoon.lua +++ /dev/null @@ -1,34 +0,0 @@ -local M = { - "ThePrimeagen/harpoon", - branch = "harpoon2", - dependencies = { - "nvim-lua/plenary.nvim", - }, -} - -M.config = function() - local harpoon = require("harpoon") - - harpoon:setup({ - settings = { - save_on_toggle = true, - sync_on_ui_close = true, - }, - }) - - nmap("a", function() - harpoon:list():add() - end, { desc = "Harpoon: Append" }) - - nmap("h", function() - harpoon.ui:toggle_quick_menu(harpoon:list()) - end, { desc = "Harpoon: Toggle Quick Menu" }) - - for i = 1, 4 do - nmap("" .. i, function() - harpoon:list():select(i) - end, { desc = "Harpoon: Select " .. i }) - end -end - -return M diff --git a/lua/plugins/lsp/extras/context.lua b/lua/plugins/lsp/extras/context.lua deleted file mode 100644 index 5fd87d7..0000000 --- a/lua/plugins/lsp/extras/context.lua +++ /dev/null @@ -1,15 +0,0 @@ -local M = { - "nvimdev/lspsaga.nvim", -} - -M.config = function() - require("lspsaga").setup({ - lightbulb = { - enable = false, - }, - }) - nmap("K", "Lspsaga hover_doc") - nmap("pd", "Lspsaga peek_definition") -end - -return M diff --git a/lua/plugins/lsp/init.lua b/lua/plugins/lsp/init.lua index d136ef9..acbb826 100644 --- a/lua/plugins/lsp/init.lua +++ b/lua/plugins/lsp/init.lua @@ -4,7 +4,6 @@ local M = { "saghen/blink.cmp", "williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim", - require("plugins.lsp.extras.context"), require("plugins.lsp.extras.lazydev"), require("plugins.lsp.extras.gopher"), require("plugins.lsp.extras.typescript"), diff --git a/lua/plugins/presenterm.lua b/lua/plugins/presenterm.lua index ecd8177..6e01ec5 100644 --- a/lua/plugins/presenterm.lua +++ b/lua/plugins/presenterm.lua @@ -1,16 +1,17 @@ return { - "marianozunino/presenterm.nvim", + dir = "/home/forbi/Dev/marianozunino/presenterm.nvim", config = function() require("presenterm").setup({ - patterns = { "*.presenterm", "*.pterm", "*.md", }, - auto_launch = true, terminal_cmd = "kitty --title 'Presenterm: {title}' --override font_size=18 {cmd}", }) + + nmap("pl", ":PresentermLaunch", { desc = "[Presenterm] Launch" }) + nmap("ps", ":PresentermStop", { desc = "[Presenterm] Stop" }) end, }