diff --git a/modules/home/neovim/default.nix b/modules/home/neovim/default.nix index 7ee5a55..573c511 100644 --- a/modules/home/neovim/default.nix +++ b/modules/home/neovim/default.nix @@ -9,10 +9,11 @@ ./plugins/diffview.nix ./plugins/grug-far.nix ./plugins/harpoon.nix + ./plugins/lsp.nix ./plugins/mini.nix - ./plugins/neogit.nix ./plugins/oil.nix + ./plugins/toggleterm.nix ./plugins/treesitter.nix ]; diff --git a/modules/home/neovim/mappings.nix b/modules/home/neovim/mappings.nix index cb594ec..1878b3b 100644 --- a/modules/home/neovim/mappings.nix +++ b/modules/home/neovim/mappings.nix @@ -128,10 +128,27 @@ key = "gg"; action.__raw = '' function() - require('neogit').open({}) + local Terminal = require('toggleterm.terminal').Terminal + local lazygit = Terminal:new({ + cmd = "lazygit", + dir = "git_dir", + direction = "float", + float_opts = { + border = "curved", + winblend = 3, + }, + on_open = function(term) + vim.cmd("startinsert!") + vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "close", {noremap = true, silent = true}) + end, + on_close = function(term) + vim.cmd("startinsert!") + end, + }) + lazygit:toggle() end ''; - options.desc = "Neogit"; + options.desc = "Lazygit (toggleterm)"; } # l - lsp/formatter { diff --git a/modules/home/neovim/plugins/neogit.nix b/modules/home/neovim/plugins/neogit.nix deleted file mode 100644 index 8fec643..0000000 --- a/modules/home/neovim/plugins/neogit.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - programs.nixvim.plugins.neogit = { - enable = true; - settings = { - disable_signs = false; - integrations = { - diffview = true; - }; - }; - }; -} diff --git a/modules/home/neovim/plugins/toggleterm.nix b/modules/home/neovim/plugins/toggleterm.nix new file mode 100644 index 0000000..4c840c5 --- /dev/null +++ b/modules/home/neovim/plugins/toggleterm.nix @@ -0,0 +1,20 @@ +{ + programs.nixvim.plugins.toggleterm = { + enable = true; + settings = { + open_mapping = null; + direction = "float"; + float_opts = { + border = "curved"; + winblend = 3; + }; + size = 20; + hide_numbers = true; + shade_terminals = true; + shading_factor = 2; + start_in_insert = true; + close_on_exit = true; + shell = "fish"; + }; + }; +} \ No newline at end of file