Gitsigns
Inline git blame, hunk operations, and change indicators
Neogit
Full interactive Git UI for staging, committing, and complex operations
CodeDiff
Side-by-side diff viewer with file history and staging
Gitsigns
Gitsigns provides git decorations and hunk-level operations directly in your buffers.Visual indicators
Changes are shown in the sign column and with number highlighting:lua/plugins/git.lua
Both staged and unstaged changes are shown with separate sign columns (signs_staged_enable = true).
Hunk navigation
| Key | Action | Description |
|---|---|---|
[g | Previous hunk | Jump to previous changed block |
]g | Next hunk | Jump to next changed block |
<leader>gp | Preview inline | Show diff inline in buffer |
<leader>gP | Preview popup | Show diff in floating window |
lua/plugins/git.lua
Git blame
Multiple ways to view blame information:- Line blame
- Buffer blame
- Inline blame mode
<leader>gb - Show commit info for current line in a popupCustom blame formatter
The blame formatter shows author, message, and formatted date:lua/plugins/git.lua
Staging operations
Reset operations
| Key | Action | Description |
|---|---|---|
<leader>gr | Reset hunk | Discard changes in current hunk |
<leader>gR | Reset buffer | Discard ALL changes in buffer |
<leader>gD | Diff HEAD | Open split diff against last commit |
Stash management
lua/plugins/git.lua
Stash picker allows you to view, apply, and drop stashes interactively.
CodeDiff
CodeDiff provides a VSCode-like side-by-side diff interface with staging support.Main features
Side-by-side diff
Compare files with move detection like VSCode
File staging
Stage/unstage files directly in the explorer
File history
Browse commit history with diffs
Merge-base diffs
PR-like diffs since branching point
Key bindings
| Key | Command | Description |
|---|---|---|
<leader>dd | :CodeDiff | Toggle diff explorer |
<leader>dh | :CodeDiff history | Browse all commit history |
<leader>d. | :CodeDiff history % | History for current file |
<leader>df | :CodeDiff file HEAD | Diff current file vs HEAD |
<leader>dm | :CodeDiff origin/main...HEAD | Merge-base diff vs origin/main |
<leader>dM | Custom | Prompt for branch to compare |
Merge-base diff example
lua/plugins/git.lua
origin/main, perfect for reviewing PRs.
Custom branch comparison
lua/plugins/git.lua
Configuration
lua/plugins/git.lua
Press
g? inside CodeDiff for a full list of available keybindings.Neogit
Neogit provides a Magit-like interface for complex Git operations.Opening Neogit
| Key | Command | Description |
|---|---|---|
<leader>gn | :Neogit | Open Neogit status panel |
<leader>gc | :Neogit commit | Open commit popup directly |
Neogit features
Interactive staging
Stage/unstage files and hunks with single keypress
Commit interface
Write commits with syntax highlighting and spell check
Push/pull
Push, pull, fetch with progress indicators
Rebase operations
Interactive rebase, squash, reword commits
Branch management
Create, switch, delete branches
Stash operations
Create and apply stashes from the z menu
Configuration
lua/plugins/git.lua
Neogit uses CodeDiff for viewing diffs and Snacks for pickers, providing a seamless integrated experience.
Common workflows
- Stage and commit
- Interactive rebase
- Branch operations
- Open Neogit with
<leader>gn - Navigate to unstaged files with
j/k - Press
sto stage a file or hunk - Press
cthencto open commit editor - Write message and save (
:wq)
Press
? inside Neogit to see all available keybindings for the current context.Atone
Time-based blame visualization plugin:lua/plugins/git.lua
:Atone to visualize code age with color gradients.
Git workflow summary
Integration with Snacks
Additional Git commands from Snacks.nvim:| Key | Command | Description |
|---|---|---|
<leader>gl | Git log line | Commits that modified current line |
<leader>go | Git browse | Open file on GitHub/GitLab in browser |
<leader>gd | Git diff | Browse all changed hunks in picker |
<leader>gS | Git stash | Browse and manage stashes |