From 860c21b1656db78529b84f721dade15892e23c82 Mon Sep 17 00:00:00 2001 From: sevi-kun Date: Wed, 12 Jul 2023 22:27:48 +0200 Subject: [PATCH] replace fugitive with neogit --- after/plugin/fugitive.lua | 1 - after/plugin/neogit.lua | 102 ++++++++++++++++++++++++++++++++++++++ lua/sevi-kun/packer.lua | 5 +- 3 files changed, 106 insertions(+), 2 deletions(-) delete mode 100644 after/plugin/fugitive.lua create mode 100644 after/plugin/neogit.lua diff --git a/after/plugin/fugitive.lua b/after/plugin/fugitive.lua deleted file mode 100644 index 73b78b8..0000000 --- a/after/plugin/fugitive.lua +++ /dev/null @@ -1 +0,0 @@ -vim.keymap.set("n", "gs", vim.cmd.Git); diff --git a/after/plugin/neogit.lua b/after/plugin/neogit.lua new file mode 100644 index 0000000..8606afe --- /dev/null +++ b/after/plugin/neogit.lua @@ -0,0 +1,102 @@ +-- git manager +local neogit = require("neogit") + +vim.keymap.set("n", "g", vim.cmd.Neogit) + +neogit.setup { + disable_signs = false, + disable_hint = false, + disable_context_highlighting = false, + disable_commit_confirmation = false, + -- Neogit refreshes its internal state after specific events, which can be expensive depending on the repository size. + -- Disabling `auto_refresh` will make it so you have to manually refresh the status after you open it. + auto_refresh = true, + -- Value used for `--sort` option for `git branch` command + -- By default, branches will be sorted by commit date descending + -- Flag description: https://git-scm.com/docs/git-branch#Documentation/git-branch.txt---sortltkeygt + -- Sorting keys: https://git-scm.com/docs/git-for-each-ref#_options + sort_branches = "-committerdate", + disable_builtin_notifications = false, + use_magit_keybindings = false, + -- Change the default way of opening neogit + kind = "vsplit", + -- The time after which an output console is shown for slow running commands + console_timeout = 2000, + -- Automatically show console if a command takes more than console_timeout milliseconds + auto_show_console = true, + -- Persist the values of switches/options within and across sessions + remember_settings = true, + -- Scope persisted settings on a per-project basis + use_per_project_settings = true, + -- Array-like table of settings to never persist. Uses format "Filetype--cli-value" + -- ie: `{ "NeogitCommitPopup--author", "NeogitCommitPopup--no-verify" }` + ignored_settings = {}, + -- Change the default way of opening the commit popup + commit_popup = { + kind = "split", + }, + -- Change the default way of opening the preview buffer + preview_buffer = { + kind = "split", + }, + -- Change the default way of opening popups + popup = { + kind = "split", + }, + -- customize displayed signs + signs = { + -- { CLOSED, OPENED } + section = { ">", "v" }, + item = { ">", "v" }, + hunk = { "", "" }, + }, + integrations = { + -- Neogit only provides inline diffs. If you want a more traditional way to look at diffs, you can use `sindrets/diffview.nvim`. + -- The diffview integration enables the diff popup, which is a wrapper around `sindrets/diffview.nvim`. + -- + -- Requires you to have `sindrets/diffview.nvim` installed. + -- use { + -- 'TimUntersberger/neogit', + -- requires = { + -- 'nvim-lua/plenary.nvim', + -- 'sindrets/diffview.nvim' + -- } + -- } + -- + diffview = false + }, + -- Setting any section to `false` will make the section not render at all + sections = { + untracked = { + folded = false + }, + unstaged = { + folded = false + }, + staged = { + folded = false + }, + stashes = { + folded = true + }, + unpulled = { + folded = true + }, + unmerged = { + folded = false + }, + recent = { + folded = true + }, + }, + -- override/add mappings + mappings = { + -- modify status buffer mappings + status = { + -- Adds a mapping with "B" as key that does the "BranchPopup" command + ["B"] = "BranchPopup", + -- Removes the default mapping of "s" + ["s"] = "", + } + } + } diff --git a/lua/sevi-kun/packer.lua b/lua/sevi-kun/packer.lua index 21196bc..6d3a922 100644 --- a/lua/sevi-kun/packer.lua +++ b/lua/sevi-kun/packer.lua @@ -21,8 +21,11 @@ return require('packer').startup(function(use) } use('ThePrimeagen/harpoon') use('mbbill/undotree') - use('tpope/vim-fugitive') use('m4xshen/autoclose.nvim') + use { + 'NeogitOrg/neogit', + requires = 'nvim-lua/plenary.nvim' + } -- pretty use({