git.nvim is an asynchronous git command wrapper plugin, using :Git command instead of :!git.
- Asynchronous Git commands — Run Git commands via
:Gitwithout blocking Neovim UI. - Full Git coverage — Status, add, commit, push/pull, fetch, diff, branch, log, reflog, rebase, and more.
- Branch Manager UI — Interactive branch list with key mappings for checkout, delete, log, and diff.
- Picker.nvim sources — Includes fuzzy finder sources like
git-branchfor quick branch switching. - Statusline integration — Easily display current branch in your statusline via Lua API.
Use your preferred Neovim plugin manager to install git.nvim.
Using nvim-plug
require('plug').add({
{
'wsdjeg/git.nvim',
depends = {
{ 'wsdjeg/job.nvim' },
{ 'wsdjeg/notify.nvim' },
},
},
})Then use :PlugInstall git.nvim to install this plugin.
Using luarocks
luarocks install --server=https://luarocks.org/manifests/wsdjeg git.nvim
Use :Git to execute git commands directly inside Neovim,
with behavior identical to the git command-line tool.
It supports command and argument completion,
runs git commands asynchronously without blocking the UI,
and opens commit messages and rebase messages in split windows
for a native, in-editor editing experience.
The plugin does not provide default key binding, here is an example:
vim.keymap.set('n', '<leader>gs', '<cmd>Git status<cr>', { silent = true })
vim.keymap.set('n', '<leader>gA', '<cmd>Git add .<cr>', { silent = true })
vim.keymap.set('n', '<leader>gc', '<cmd>Git commit<cr>', { silent = true })
vim.keymap.set('n', '<leader>gv', '<cmd>Git log<cr>', { silent = true })
vim.keymap.set('n', '<leader>gV', '<cmd>Git log %<cr>', { silent = true })
vim.keymap.set('n', '<leader>gp', '<cmd>Git push<cr>', { silent = true })
vim.keymap.set('n', '<leader>gd', '<cmd>Git diff<cr>', { silent = true })just same as git add <path>, % will be replaced as current file.
:Git branch without argument will open branch manager, within the branch manager these key bindings are available:
| key binding | description |
|---|---|
dd |
delete branch under cursor |
<Enter> |
checkout branch under cursor |
v |
view git log of branch under cursor |
f |
view git diff between current branch and branch under cursor |
If you want to display branch info on statusline, you can use v:lua.require("git.command.branch").current(), for example:
using statusline.nvim:
require('plug').add({
{
'wsdjeg/statusline.nvim',
events = { 'VimEnter' },
config = function()
require('statusline').register_sections('vcs', function()
return '%{ v:lua.require("git.command.branch").current() }'
end)
require('statusline').setup({
left_sections = { 'winnr', 'filename', 'vcs' },
})
end,
},
})This plugin also provides sources for picker.nvim
git-branch: fuzzy find git branch to checkoutgit-ghosts: fuzzy find deleted files
Like this plugin? Star the repository on GitHub.
Love this plugin? Follow me on GitHub
If you encounter any bugs or have suggestions, please file an issue in the issue tracker
