+1
Daily
5,677
stars
368
forks
24
watchers
931
prs
853
issues
3
releases
README
Neogit
A git interface for Neovim, inspired by Magit.
!preview
Installation
Here's an example spec for Lazy, but you're free to use whichever plugin manager suits you.
lua
{
"NeogitOrg/neogit",
lazy = true,
dependencies = {
-- Only one of these is needed.
"sindrets/diffview.nvim", -- optional
"esmuellert/codediff.nvim", -- optional
-- For a custom log pager
"m00qek/baleia.nvim", -- optional
-- Only one of these is needed.
"nvim-telescope/telescope.nvim", -- optional
"ibhagwan/fzf-lua", -- optional
"nvim-mini/mini.pick", -- optional
"folke/snacks.nvim", -- optional
},
cmd = "Neogit",
keys = {
{ "gg", "Neogit", desc = "Show Neogit UI" }
}
}
Usage
You can either open Neogit by using the Neogit command:
vim
:Neogit " Open the status buffer in a new tab
:Neogit cwd= " Use a different repository path
:Neogit cwd=%:p:h " Uses the repository of the current file
:Neogit kind= " Open specified popup directly
:Neogit commit " Open commit popup
" Map it to a key
nnoremap gg Neogit
lua
-- Or via lua api
vim.keymap.set("n", "gg", "Neogit", { desc = "Open Neogit UI" })
Or using the lua api:
lua
local neogit = require('neogit')
-- open using defaults
neogit.open()
-- open a specific popup
neogit.open({ "commit" })
-- open as a split
neogit.open({ kind = "split" })
-- open with different project
neogit.open({ cwd = "~" })
-- You can map this to a key
vim.keymap.set("n", "gg", neogit.open, { desc = "Open Neogit UI" })
-- Wrap in a function to pass additional arguments
vim.keymap.set(
"n",
"gg",
function() neogit.open({ kind = "split" }) end,
{ desc = "Open Neogit UI" }
)
The kind option can be one of the following values:
- tab (default)
- replace
- split
- split_above
- split_above_all
- split_below
- split_below_all
- vsplit
- floating
- auto (vsplit if window would have 80 cols, otherwise split)
Configuration
You can configure neogit by running the require('neogit').setup {} function, passing a table as the argument.
Default Config
lua
local neogit = require("neogit")
neogit.setup {
-- Use Treesitter to apply syntax highlighting to diff hunks
treesitter_diff_highlight = true,
-- Apply word-diff highlights to diff hunks
word_diff_highlight = true,
-- Hides the hints at the top of the status buffer
disable_hint = false,
-- Disables changing the buffer highlights based on where the cursor is.
disable_context_highlighting = false,
-- Disables signs for sections/items/hunks
disable_signs = false,
-- Path to git executable. Defaults to "git". Can be used to specify a custom git binary or wrapper script.
git_executable = "git",
-- Offer to force push when branches diverge
prompt_force_push = true,
-- Request confirmation when amending already published cTop issues
#127Git checkout remote branch results in a detached head22 comments · 2021-05-19#520Add a keybinding for 'git add --intent-to-add' ('git add -D')20 comments · 2023-06-08#1239Add support to goto hunk locations from commit view15 comments · 2024-04-05#1539Neogit disables numbers for new buffers opened13 comments · 2024-11-03#1324vim.wait must not be called in a lua loop callback13 comments · 2024-05-24#682Reduce number of messages13 comments · 2023-07-31#332Support for `--bare` git repos13 comments · 2022-08-09#1621Can't stage after resolving conflicts during a rebase12 comments · 2025-01-07
Discussions
#2021Diff whole branch being able to edit the worktree1 comments · 2026-10-12#2016Add the possibility to reverse visual selections in commit view0 comments · 2026-09-28#2000Add information about using visual line to stage/unstage specific lines1 comments · 2026-08-03#1997Writing commit body with neogit?1 comments · 2026-07-29#1991Opening staged/unstaged files in quickfix list0 comments · 2026-07-17#1986How to open the commit view by ID?1 comments · 2026-07-11#1979Jump to file entry in status section0 comments · 2026-07-05#1965Need help with `git log -S` in Neogit0 comments · 2026-06-03
Latest release
v2.0.0 v2.0.0 2024-11-07Removes NeogitCommitMessage and NeogitRebaseTodo filetypes in favor of gitcommit and gitrebase.