diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index c950e183..6beda282 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -17,10 +17,11 @@ "crates.nvim": { "branch": "main", "commit": "8bf8358ee326d5d8c11dcd7ac0bcc9ff97dbc785" }, "dashboard-nvim": { "branch": "master", "commit": "ae309606940d26d8c9df8b048a6e136b6bbec478" }, "dial.nvim": { "branch": "master", "commit": "46b4375e84e8eb771129bff6b2b1e47746601ef9" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "dressing.nvim": { "branch": "master", "commit": "fc78a3ca96f4db9f8893bb7e2fd9823e0780451b" }, "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "grug-far.nvim": { "branch": "main", "commit": "5613d0e314b2fe09d85e8392e6a63c2d57e85840" }, + "grug-far.nvim": { "branch": "main", "commit": "4b19888719e45ed696d140af2e4e4e3840a5387a" }, "image.nvim": { "branch": "master", "commit": "5f8fceca2d1be96a45b81de21c2f98bf6084fb34" }, "inc-rename.nvim": { "branch": "main", "commit": "1871ca49ae6ee3e9ebee37955ba10c7b1425974f" }, "indent-blankline.nvim": { "branch": "master", "commit": "259357fa4097e232730341fa60988087d189193a" }, @@ -43,6 +44,7 @@ "mini.move": { "branch": "main", "commit": "4caa1c212f5ca3d1633d21cfb184808090ed74b1" }, "mini.pairs": { "branch": "main", "commit": "7e834c5937d95364cc1740e20d673afe2d034cdb" }, "mini.surround": { "branch": "main", "commit": "48a9795c9d352c771e1ab5dedab6063c0a2df037" }, + "neogit": { "branch": "master", "commit": "11e14b67eb19bada54c9eb8bc70a581f358cd175" }, "neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" }, "neotest-golang": { "branch": "main", "commit": "219ac8289db58802aaa331d499e8610bfcd861c0" }, "neotest-python": { "branch": "master", "commit": "a2861ab3c9a0bf75a56b11835c2bfc8270f5be7e" }, @@ -51,7 +53,7 @@ "noice.nvim": { "branch": "main", "commit": "d5451b0d0e166e79aaabd79a04fc1cf185cc5b4d" }, "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, "nvim-cmp": { "branch": "main", "commit": "ca4d3330d386e76967e53b85953c170658255ecb" }, - "nvim-dap": { "branch": "master", "commit": "ab55b6c1fbde793c5cee2df9dbbdff85c4698c5c" }, + "nvim-dap": { "branch": "master", "commit": "6fd05c6ee98b08a2c6ee7d81e1927a152990df05" }, "nvim-dap-go": { "branch": "main", "commit": "6aa88167ea1224bcef578e8c7160fe8afbb44848" }, "nvim-dap-python": { "branch": "master", "commit": "34282820bb713b9a5fdb120ae8dd85c2b3f49b51" }, "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, diff --git a/.config/nvim/lua/plugins/diffview.lua b/.config/nvim/lua/plugins/diffview.lua new file mode 100644 index 00000000..e69de29b diff --git a/.config/nvim/lua/plugins/neogit.lua b/.config/nvim/lua/plugins/neogit.lua new file mode 100644 index 00000000..5d47f5f1 --- /dev/null +++ b/.config/nvim/lua/plugins/neogit.lua @@ -0,0 +1,359 @@ +return { + "NeogitOrg/neogit", + enabled = "false", + dependencies = { + "nvim-lua/plenary.nvim", -- required + "sindrets/diffview.nvim", -- optional - Diff integration + "nvim-telescope/telescope.nvim", -- optional + }, + keys = { + { + "gn", + function() + require("neogit").open() + end, + { + desc = "Open Neogit", + }, + }, + }, + opts = { + -- Hides the hints at the top of the status buffer + disable_hint = false, + -- Disables changing the buffer highlights based on where the cursor is. + disable_context_highlighting = false, + -- Disables signs for sections/items/hunks + disable_signs = false, + -- Changes what mode the Commit Editor starts in. `true` will leave nvim in normal mode, `false` will change nvim to + -- insert mode, and `"auto"` will change nvim to insert mode IF the commit message is empty, otherwise leaving it in + -- normal mode. + disable_insert_on_commit = "auto", + -- When enabled, will watch the `.git/` directory for changes and refresh the status buffer in response to filesystem + -- events. + filewatcher = { + interval = 1000, + enabled = true, + }, + -- "ascii" is the graph the git CLI generates + -- "unicode" is the graph like https://github.com/rbong/vim-flog + -- "kitty" is the graph like https://github.com/isakbm/gitgraph.nvim - use https://github.com/rbong/flog-symbols if you don't use Kitty + graph_style = "kitty", + -- Show relative date by default. When set, use `strftime` to display dates + commit_date_format = nil, + log_date_format = nil, + -- Used to generate URL's for branch popup action "pull request". + git_services = { + ["github.com"] = "https://github.com/${owner}/${repository}/compare/${branch_name}?expand=1", + ["bitbucket.org"] = "https://bitbucket.org/${owner}/${repository}/pull-requests/new?source=${branch_name}&t=1", + ["gitlab.com"] = "https://gitlab.com/${owner}/${repository}/merge_requests/new?merge_request[source_branch]=${branch_name}", + ["azure.com"] = "https://dev.azure.com/${owner}/_git/${repository}/pullrequestcreate?sourceRef=${branch_name}&targetRef=${target}", + }, + -- Allows a different telescope sorter. Defaults to 'fuzzy_with_index_bias'. The example below will use the native fzf + -- sorter instead. By default, this function returns `nil`. + telescope_sorter = function() + return require("telescope").extensions.fzf.native_fzf_sorter() + end, + -- 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, + -- Table of settings to never persist. Uses format "Filetype--cli-value" + ignored_settings = { + "NeogitPushPopup--force-with-lease", + "NeogitPushPopup--force", + "NeogitPullPopup--rebase", + "NeogitCommitPopup--allow-empty", + "NeogitRevertPopup--no-edit", + }, + -- Configure highlight group features + highlight = { + italic = true, + bold = true, + underline = true, + }, + -- Set to false if you want to be responsible for creating _ALL_ keymappings + use_default_keymaps = true, + -- 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", + -- Default for new branch name prompts + initial_branch_name = "", + -- Change the default way of opening neogit + kind = "tab", + -- Disable line numbers + disable_line_numbers = true, + -- Disable relative line numbers + disable_relative_line_numbers = true, + -- 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, + -- Automatically close the console if the process exits with a 0 (success) status + auto_close_console = true, + notification_icon = "󰊢", + status = { + show_head_commit_hash = true, + recent_commit_count = 10, + HEAD_padding = 10, + HEAD_folded = false, + mode_padding = 3, + mode_text = { + M = "modified", + N = "new file", + A = "added", + D = "deleted", + C = "copied", + U = "updated", + R = "renamed", + DD = "unmerged", + AU = "unmerged", + UD = "unmerged", + UA = "unmerged", + DU = "unmerged", + AA = "unmerged", + UU = "unmerged", + ["?"] = "", + }, + }, + commit_editor = { + kind = "tab", + show_staged_diff = true, + -- Accepted values: + -- "split" to show the staged diff below the commit editor + -- "vsplit" to show it to the right + -- "split_above" Like :top split + -- "vsplit_left" like :vsplit, but open to the left + -- "auto" "vsplit" if window would have 80 cols, otherwise "split" + staged_diff_split_kind = "split", + spell_check = true, + }, + commit_select_view = { + kind = "tab", + }, + commit_view = { + kind = "vsplit", + verify_commit = vim.fn.executable("gpg") == 1, -- Can be set to true or false, otherwise we try to find the binary + }, + log_view = { + kind = "tab", + }, + rebase_editor = { + kind = "auto", + }, + reflog_view = { + kind = "tab", + }, + merge_editor = { + kind = "auto", + }, + description_editor = { + kind = "auto", + }, + tag_editor = { + kind = "auto", + }, + preview_buffer = { + kind = "floating_console", + }, + popup = { + kind = "split", + }, + stash = { + kind = "tab", + }, + refs_view = { + kind = "tab", + }, + signs = { + -- { CLOSED, OPENED } + hunk = { "", "" }, + item = { ">", "v" }, + section = { ">", "v" }, + }, + -- Each Integration is auto-detected through plugin presence, however, it can be disabled by setting to `false` + integrations = { + -- If enabled, use telescope for menu selection rather than vim.ui.select. + -- Allows multi-select and some things that vim.ui.select doesn't. + telescope = nil, + -- Neogit only provides inline diffs. If you want a more traditional way to look at diffs, you can use `diffview`. + -- The diffview integration enables the diff popup. + -- + -- Requires you to have `sindrets/diffview.nvim` installed. + diffview = nil, + + -- If enabled, uses fzf-lua for menu selection. If the telescope integration + -- is also selected then telescope is used instead + -- Requires you to have `ibhagwan/fzf-lua` installed. + fzf_lua = nil, + + -- If enabled, uses mini.pick for menu selection. If the telescope integration + -- is also selected then telescope is used instead + -- Requires you to have `echasnovski/mini.pick` installed. + mini_pick = nil, + }, + sections = { + -- Reverting/Cherry Picking + sequencer = { + folded = false, + hidden = false, + }, + untracked = { + folded = false, + hidden = false, + }, + unstaged = { + folded = false, + hidden = false, + }, + staged = { + folded = false, + hidden = false, + }, + stashes = { + folded = true, + hidden = false, + }, + unpulled_upstream = { + folded = true, + hidden = false, + }, + unmerged_upstream = { + folded = false, + hidden = false, + }, + unpulled_pushRemote = { + folded = true, + hidden = false, + }, + unmerged_pushRemote = { + folded = false, + hidden = false, + }, + recent = { + folded = true, + hidden = false, + }, + rebase = { + folded = true, + hidden = false, + }, + }, + mappings = { + commit_editor = { + ["q"] = "Close", + [""] = "Submit", + [""] = "Abort", + [""] = "PrevMessage", + [""] = "NextMessage", + [""] = "ResetMessage", + }, + commit_editor_I = { + [""] = "Submit", + [""] = "Abort", + }, + rebase_editor = { + ["p"] = "Pick", + ["r"] = "Reword", + ["e"] = "Edit", + ["s"] = "Squash", + ["f"] = "Fixup", + ["x"] = "Execute", + ["d"] = "Drop", + ["b"] = "Break", + ["q"] = "Close", + [""] = "OpenCommit", + ["gk"] = "MoveUp", + ["gj"] = "MoveDown", + [""] = "Submit", + [""] = "Abort", + ["[c"] = "OpenOrScrollUp", + ["]c"] = "OpenOrScrollDown", + }, + rebase_editor_I = { + [""] = "Submit", + [""] = "Abort", + }, + finder = { + [""] = "Select", + [""] = "Close", + [""] = "Close", + [""] = "Next", + [""] = "Previous", + [""] = "Next", + [""] = "Previous", + [""] = "InsertCompletion", + [""] = "MultiselectToggleNext", + [""] = "MultiselectTogglePrevious", + [""] = "NOP", + [""] = "ScrollWheelDown", + [""] = "ScrollWheelUp", + [""] = "NOP", + [""] = "NOP", + [""] = "MouseClick", + ["<2-LeftMouse>"] = "NOP", + }, + -- Setting any of these to `false` will disable the mapping. + popup = { + ["?"] = "HelpPopup", + ["A"] = "CherryPickPopup", + ["d"] = "DiffPopup", + ["M"] = "RemotePopup", + ["P"] = "PushPopup", + ["X"] = "ResetPopup", + ["Z"] = "StashPopup", + ["i"] = "IgnorePopup", + ["t"] = "TagPopup", + ["b"] = "BranchPopup", + ["B"] = "BisectPopup", + ["w"] = "WorktreePopup", + ["c"] = "CommitPopup", + ["f"] = "FetchPopup", + ["l"] = "LogPopup", + ["m"] = "MergePopup", + ["p"] = "PullPopup", + ["r"] = "RebasePopup", + ["v"] = "RevertPopup", + }, + status = { + ["j"] = "MoveDown", + ["k"] = "MoveUp", + ["o"] = "OpenTree", + ["q"] = "Close", + ["I"] = "InitRepo", + ["1"] = "Depth1", + ["2"] = "Depth2", + ["3"] = "Depth3", + ["4"] = "Depth4", + ["Q"] = "Command", + [""] = "Toggle", + ["x"] = "Discard", + ["s"] = "Stage", + ["S"] = "StageUnstaged", + [""] = "StageAll", + ["u"] = "Unstage", + ["K"] = "Untrack", + ["U"] = "UnstageStaged", + ["y"] = "ShowRefs", + ["$"] = "CommandHistory", + ["Y"] = "YankSelected", + [""] = "RefreshBuffer", + [""] = "GoToFile", + [""] = "PeekFile", + [""] = "VSplitOpen", + [""] = "SplitOpen", + [""] = "TabOpen", + ["{"] = "GoToPreviousHunkHeader", + ["}"] = "GoToNextHunkHeader", + ["[c"] = "OpenOrScrollUp", + ["]c"] = "OpenOrScrollDown", + [""] = "PeekUp", + [""] = "PeekDown", + }, + }, + }, +}