refactor(nvim): extract neogit to its own plugin file

This commit is contained in:
Price Hiller 2024-06-17 15:56:45 -05:00
parent 6d913a741c
commit 1214389a57
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB
2 changed files with 58 additions and 50 deletions

View File

@ -29,56 +29,6 @@ return {
enhanced_diff_hl = true,
},
},
{
"neogitorg/neogit",
cmd = { "Neogit" },
keys = {
{ "<leader>g", desc = "> Git" },
{ "<leader>gg", "<cmd>Neogit<CR>", 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" },

View File

@ -0,0 +1,58 @@
return {
{
"neogitorg/neogit",
cmd = { "Neogit" },
keys = {
{ "<leader>g", desc = "> Git" },
{ "<leader>gg", "<cmd>Neogit<CR>", 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",
},
},
}