lewis6991 / gitsigns.nvim
git clone https://github.com/lewis6991/gitsigns.nvim.git
v2.1.0 · 6mo ago
🔥 on GitHub Trending today
Git integration for buffers
—
stars, 24h
+10
stars, 7 days · #1,580
+57
stars, 30 days · #4,568
7.1k
★ total · +0% this week
299
forks · 36 open issues
Star history starts 2026-10-20; the chart appears after the second daily snapshot.
LanguageLua
LicenseMIT
Created2020-10-18 (6y ago)
Last push7d ago
Watchers24
OwnerUser
Seen on GitHub Trending
- 2026-10-20 — #15 monthly in lua · +57 ★
- 2026-10-20 — #10 weekly in lua · +10 ★
GitHub topics
Links
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