From 1214389a579d6a8bb079f45d7c7b9be8f64d6fd3 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Mon, 17 Jun 2024 15:56:45 -0500 Subject: [PATCH] refactor(nvim): extract `neogit` to its own plugin file --- .../.config/nvim/lua/plugins/configs/git.lua | 50 ---------------- .../nvim/lua/plugins/configs/neogit.lua | 58 +++++++++++++++++++ 2 files changed, 58 insertions(+), 50 deletions(-) create mode 100644 users/price/dots/.config/nvim/lua/plugins/configs/neogit.lua diff --git a/users/price/dots/.config/nvim/lua/plugins/configs/git.lua b/users/price/dots/.config/nvim/lua/plugins/configs/git.lua index 6d70a671..27d9ec58 100644 --- a/users/price/dots/.config/nvim/lua/plugins/configs/git.lua +++ b/users/price/dots/.config/nvim/lua/plugins/configs/git.lua @@ -29,56 +29,6 @@ return { enhanced_diff_hl = true, }, }, - { - "neogitorg/neogit", - cmd = { "Neogit" }, - keys = { - { "g", desc = "> Git" }, - { "gg", "Neogit", desc = "Neogit: Open" }, - }, - opts = function() - vim.api.nvim_create_autocmd("FileType", { - pattern = "*Neogit*", - callback = function() - vim.opt_local.list = false - vim.opt_local.foldmethod = "manual" - end, - }) - - ---@type NeogitConfig - return { - disable_insert_on_commit = "auto", - disable_commit_confirmation = true, - disable_builtin_notifications = true, - auto_refresh = true, - auto_show_console = false, - disable_signs = true, - preview_buffer = { - kind = "split", - }, - filewatcher = { - enabled = true, - interval = 1000, - }, - graph_style = "unicode", - integrations = { - diffview = true, - telescope = true, - }, - mappings = { - popup = { - ["l"] = false, - ["L"] = "LogPopup", - }, - }, - } - end, - dependencies = { - "sindrets/diffview.nvim", - "nvim-lua/plenary.nvim", - "nvim-telescope/telescope.nvim", - }, - }, { "lewis6991/gitsigns.nvim", event = { "BufReadPre", "BufNewFile" }, diff --git a/users/price/dots/.config/nvim/lua/plugins/configs/neogit.lua b/users/price/dots/.config/nvim/lua/plugins/configs/neogit.lua new file mode 100644 index 00000000..7916c6ab --- /dev/null +++ b/users/price/dots/.config/nvim/lua/plugins/configs/neogit.lua @@ -0,0 +1,58 @@ +return { + { + "neogitorg/neogit", + cmd = { "Neogit" }, + keys = { + { "g", desc = "> Git" }, + { "gg", "Neogit", desc = "Neogit: Open" }, + }, + config = function() + vim.api.nvim_create_autocmd("FileType", { + pattern = "*Neogit*", + callback = function() + vim.opt_local.foldmethod = "manual" + end, + }) + + vim.api.nvim_create_autocmd("FileType", { + pattern = "gitcommit", + callback = function() + vim.api.nvim_win_set_cursor(0, { 1, 0 }) + vim.cmd.startinsert() + end, + }) + + require("neogit").setup({ + disable_insert_on_commit = true, + disable_commit_confirmation = true, + disable_builtin_notifications = true, + auto_refresh = true, + auto_show_console = false, + disable_signs = true, + preview_buffer = { + kind = "split", + }, + filewatcher = { + enabled = true, + interval = 1000, + }, + graph_style = "unicode", + integrations = { + diffview = true, + telescope = true, + }, + mappings = { + popup = { + ["l"] = false, + ["L"] = "LogPopup", + }, + }, + }) + end, + dependencies = { + "sindrets/diffview.nvim", + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope.nvim", + }, + }, +}