Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ nvim --headless "+Lazy! sync" +qa

You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration.

### Docs

* [Git in Neovim (Neogit + Diffview)](doc/git.md)

#### Example: Adding an autopairs plugin

In the file: `lua/custom/plugins/autopairs.lua`, add:
Expand Down Expand Up @@ -157,4 +161,3 @@ This requires:
```lua
{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
```

62 changes: 62 additions & 0 deletions doc/git.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Git in Neovim (Neogit + Diffview)

This config uses **Neogit** as the Git UI (replacing Fugitive) and **Diffview** for diffs + merge conflict resolution.

## Entry points (this config)

- `\<leader>gs` → open Neogit status
- `\<leader>gd` → open Diffview
- `\<leader>gD` → close Diffview
- `\<leader>gh` → Diffview file history
- `\<leader>hp` → preview hunk (Gitsigns)

## Neogit: status, stage, commit

Open status: `\<leader>gs`

Common keys in the status buffer:

- `s` stage item under cursor
- `S` stage all unstaged
- `u` unstage item under cursor
- `U` unstage all staged
- `x` discard item under cursor
- `<c-r>` refresh
- `c` open commit popup (then pick an action)

## Neogit: merge + rebase

From Neogit status (`\<leader>gs`):

- `m` opens the merge popup (merge actions)
- `r` opens the rebase popup (rebase actions, continue/abort when in progress)

Neogit shows the available actions/keys in the popup window; follow those prompts.

## Conflicts (Diffview)

When you have conflicts, open Diffview: `\<leader>gd` and select a conflicted file.

In Diffview’s merge tool:

- Next/prev conflict: `]x` / `[x`
- Choose for the current conflict:
- `\<leader>co` = choose ours
- `\<leader>ct` = choose theirs
- `\<leader>cb` = choose base
- `\<leader>ca` = choose all (keep both)
- `dx` = delete conflict region

After resolving:

1. Save (`:w`)
2. Stage in Neogit (`\<leader>gs`, then `s`/`S`)
3. Use Neogit’s rebase popup (`r`) to continue, or commit (via `c`) if you’re finishing a merge.

## Undo / back out

- Undo an edit: `u` (redo: `<c-r>`)
- Undo a conflict choice you just applied: `u`
- Discard file/hunk from Neogit status: `x`
- Abort an in-progress rebase/merge: use the `r`/`m` popup actions (Neogit will show “abort/continue” options when applicable).

36 changes: 33 additions & 3 deletions lua/coldboot/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,38 @@
-- if you are looking for vscode specific plugins look for the coldboot/vscode
-- directory
return { -- Git related plugins
'tpope/vim-fugitive',
'tpope/vim-rhubarb', -- Detect tabstop and shiftwidth automatically
{
'NeogitOrg/neogit',
dependencies = {
'nvim-lua/plenary.nvim',
'sindrets/diffview.nvim',
},
keys = {
{
'<leader>gs',
function()
require('neogit').open()
end,
desc = '[G]it [S]tatus',
},
},
opts = {
kind = 'tab',
integrations = {
diffview = true,
},
},
},
{
'sindrets/diffview.nvim',
cmd = { 'DiffviewOpen', 'DiffviewClose', 'DiffviewFileHistory' },
keys = {
{ '<leader>gd', '<cmd>DiffviewOpen<cr>', desc = '[G]it [D]iff view' },
{ '<leader>gD', '<cmd>DiffviewClose<cr>', desc = '[G]it [D]iff close' },
{ '<leader>gh', '<cmd>DiffviewFileHistory<cr>', desc = '[G]it file [H]istory' },
},
opts = {},
},
'tpope/vim-sleuth', -- NOTE: This is where your plugins related to LSP can be installed.
-- The configuration is done below. Search for lspconfig to find it below.
-- LSP Configuration is now in lua/coldboot/plugins/lsp.lua
Expand Down Expand Up @@ -40,7 +70,7 @@ return { -- Git related plugins
desc = 'Preview git hunk',
})

-- don't override the built-in and fugitive keymaps
-- don't override the built-in diff keymaps
local gs = package.loaded.gitsigns
vim.keymap.set({ 'n', 'v' }, ']c', function()
if vim.wo.diff then
Expand Down
Loading