182e507dc75be6d8693d2501c8121a94070e0755
git.nvim
A git workflow integration for Neovim.
Features:
- Status sidebar with stage/unstage/discard actions
- Log viewer
- Diff splits against any revision, the index, or the worktree
- Gutter signs + optional diff overlay
- Per-hunk stage / reset / preview / select
- Blame: cursor-line popup, inline annotation, full-file gutter
- Commit proxy (compose in a Neovim buffer)
- Generic
:G <subcommand>runner git://<rev>:<path>URIs (worktree, index, stages, blobs, bare objects)
Requires Neovim v0.12+ and git v2.25+.
Install
The plugin auto-initializes from its plugin/git.lua and exposes lua/git/. No setup() call is required.
With vim.pack:
vim.pack.add({ "https://git.owall.dev/warg/git.nvim" })
Commands
| Command | Action |
|---|---|
:G[!] [args...] |
Generic git runner |
:Grefresh |
Refresh git status for all repos |
:Glog [args...] |
Open the log viewer |
:Gdiffsplit [vertical|horizontal] [<rev>] |
Open a diff split (default vertical, vs index) |
:Gedit <rev>[:path] |
Open an object as a buffer (git:// URI) |
:Gstatus [sidebar|split|current] |
Open the status view (default split) |
:GitDiffOverlay |
Toggle the in-buffer diff overlay |
<Plug> mappings
| Plug map | Action |
|---|---|
<Plug>(git-status-toggle) |
Toggle status sidebar |
<Plug>(git-log) |
Open log viewer |
<Plug>(git-commit) |
Compose a commit |
<Plug>(git-commit-amend) |
Amend the last commit |
<Plug>(git-diffsplit-vertical) |
Vertical diff vs index |
<Plug>(git-diffsplit-vertical-head) |
Vertical diff vs HEAD |
<Plug>(git-diffsplit-horizontal) |
Horizontal diff vs index |
<Plug>(git-diffsplit-horizontal-head) |
Horizontal diff vs HEAD |
<Plug>(git-blame-popup) |
Cursor-line blame popup |
<Plug>(git-blame-view) |
Toggle full-file blame overlay |
<Plug>(git-hunk-select) |
Visually select the hunk under cursor |
<Plug>(git-hunk-stage-toggle) |
Stage / unstage hunk |
<Plug>(git-hunk-reset) |
Reset hunk |
<Plug>(git-hunk-overlay-toggle) |
Toggle the in-buffer diff overlay |
<Plug>(git-hunk-next) |
Jump to next hunk |
<Plug>(git-hunk-prev) |
Jump to previous hunk |
Bind one with e.g.
vim.keymap.set("n", "<leader>gg", "<Plug>(git-status-toggle)")
Globals
vim.g.loaded_git = 1: skip auto-initialization (set before the plugin loads).vim.g.git_hunk_signs = { add?, change?, delete? }: override the gutter glyphs (default┃).
Highlight groups
See the DEFAULT_HIGHLIGHTS table for the full list.
Description
Languages
Lua
99.3%
Shell
0.4%
Vim Script
0.3%