lewis6991 / gitsigns.nvim
git clone https://github.com/lewis6991/gitsigns.nvim.git
v2.1.0 Β· 7mo ago
π₯ on GitHub Trending today
Neovim plugin that shows Git hunks in the sign column and provides hunk staging, resetting, blame, and diff actions per buffer.
Why you might care
Gives Neovim users buffer-level Git feedback without leaving the editor: signs for added, changed, and deleted lines, inline and popup hunk previews, and current-line blame. Supports staging and resetting partial hunks in visual mode and word-level diffs. Requires Neovim 0.11 or newer and a recent git.
+1
stars, 24h Β· #13,856
+13
stars, 7 days Β· #10,794
+~30
stars, 30 days Β· #18,007
7.1k
β
total Β· +0% this week
300
forks Β· 37 open issues
Star history (as recorded here)
LanguageLua
LicenseMIT
Created2020-10-18 (6y ago)
Last pushtoday
Watchers24
OwnerUser
Seen on GitHub Trending
- 2026-10-23 β #10 weekly in lua Β· +12 β
- 2026-10-22 β #7 weekly in lua Β· +13 β
- 2026-10-21 β #15 monthly in lua Β· +56 β
- 2026-10-21 β #10 weekly in lua Β· +10 β
- 2026-10-20 β #15 monthly in lua Β· +57 β
- 2026-10-20 β #10 weekly in lua Β· +10 β
GitHub topics
Links
- GitHub: github.com/lewis6991/gitsigns.nvim
- Releases Β· Issues Β· Hacker News mentions
README excerpt
# gitsigns.nvim
Deep buffer integration for Git
## π Preview
| Hunk Actions | Line Blame |
| --- | ----------- |
| | |
## β¨ Features
Signs
- Adds signs to the sign column to indicate added, changed, and deleted lines.
- Supports different signs for staged changes.
- Add counts to signs.
Hunk Actions
- Stage/unstage hunks with `:Gitsigns stage_hunk`.
- Reset hunks with `:Gitsigns reset_hunk`.
- Also works on partial hunks in visual mode.
- Preview hunks inline with `:Gitsigns preview_hunk_inline`
- Preview hunks in popup with `:Gitsigns preview_hunk`
- Navigate between hunks with `:Gitsigns nav_hunk next/prev`.
Blame
- Show blame of current buffer using `:Gitsigns blame`.
- Show blame information for the current line in popup with `:Gitsigns blame_line`.
- Show blame information for the current line in virtual text.
- Enable with `setup({ current_line_blame = true })`.
- Toggle with `:Gitsigns toggle_current_line_blame`
Diff
- Change the revision for the signs with `:Gitsigns change_base `.
- Show the diff of the current buffer with the index or any revision
with `:Gitsigns diffthis `.
- Show intra-line word-diff in the buffer.
- Enable with `setup({ word_diff = true })`.
- Toggle with `:Gitsigns toggle_word_diff`.
Show hunks Quickfix/Location List
- Set the quickfix/location list with changes with `:Gitsign setqflist/setloclist`.
Can show hunks for:
- whole repository (`target=all`)
- attached buffers (`target=attached`)
- a specific buffer (`target=[integer]`).
Text Object
- Select hunks as a text object.
- Can use `vim.keymap.set({'o', 'x'}, 'ih', ' Gitsigns select_hunk ')`
Status Line Integration
Use `b:gitsigns_status` or `b:gitsigns_status_dict`. `b:gitsigns_status` is
formatted using `config.status_formatter`. `b:gitsigns_status_dict` is a
dictionary with the keys `added`, `removed`, `changed` and `head`.
Example:
[code]
For the current branch use the variable `b:gitsigns_head`.
Show different revisions of buffers
- Use `:Gitsigns show :%` to `:edit` the current buffer at ` `
## π Requirements
- Neovim >= 0.11.0
> [!TIP]
> If your version of Neovim is too old, then you can use a past [release].
> [!WARNING]
> If you are running a development version of Neovim (aka `master`), then
> breakage may occur if your build is behind latest.
- Newish version of git. Older versions may not work with some features.
## π οΈ Installation & Usage
Install using your package manager of choice. No setup required.
Optional configuration can be passed to the setup function. Here is an example
with most of the default settings:
[code]
For information on configuring Neovim via lua please see [nvim-lua-guide].
### πΉ Keymaps
Gitsigns provides an `on_attach` callback which can be used to setup buffer mappings.
Here is a suggested example:
[code]
## π Plugin Integrations
### [vim-fugitive]
When viewing revisions of a file (via `:0Gclog` for example), Gitsigns will attach to the fugitive buffer with the base set to
Blurb generated by claude-haiku-5-5 today. Star deltas marked ~ are extrapolated from partial history.