Git plugin for Neovim (based on libgit2).
- ✔ Floating git source window.
- ✔ Magit style menu.
- ✔ Patch View.
- ✔ Stage/Unstage hunkes in patch view.
- ✔ Nice git graph.
- ☐ TODO: In-memory rebase.
- ☐ TODO: Diff view.
- ☐ TODO: Remap default key binding.
- ☐ TODO: Proper help menu.
- ☐ TODO: Native branch popup.
Third party libraries:
How to install libgit2
Libgit2 is required for this plugin to work. So you have to install it in your OS before starting with Fugit2. For more information, you can refer to this https://libgit2.org/
sudo apt-get install -y libgit2-1.1
sudo ln -s /usr/lib/x86_64-linux-gnu/libgit2.so.1.1 /usr/local/lib/libgit2.so
sudo ldconfig
sudo apt-get install -y libgit2-1.5
sudo ln -s /usr/lib/x86_64-linux-gnu/libgit2.so.1.5 /usr/local/lib/libgit2.so
sudo ldconfig
sudo pacman -S libgit2
brew install libgit2
There are no pre-packaged releases of libgit2 on Windows so the library must be built from source.
#requires -RunAsAdministrator
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=User'
choco install mingw
Make sure to restart your terminal after installing MinGW to ensure that the gcc
and g++
commands are available.
git clone https://github.com/libgit2/libgit2
cd libgit2
mkdir build
cd build
cmake -G "MinGW Makefiles" ..
cmake --build .
Now you should have a libgit2.dll
in the build
directory. This should be copied to a location in your PATH
or to the same directory as your Neovim executable.
How to install gpgme
If you do config enabling git gpg signing, you must install GPGme lib for fugit2 to work.
In addition, you should config gpg-agent to use a GUI Pinentry, so that it don't disrupt terminal when asking passphrase.
brew install gpgme pinentry-mac
echo "pinentry-program $(which pinentry-mac)" >> ~/.gnupg/gpg-agent.conf
sudo apt-get install libgpgme-dev
sudo pacman -S gpgme
If you are using lazy, you can use this config
{
'SuperBo/fugit2.nvim',
opts = {
width = 70,
},
dependencies = {
'MunifTanjim/nui.nvim',
'nvim-tree/nvim-web-devicons',
'nvim-lua/plenary.nvim',
{
'chrisgrieser/nvim-tinygit', -- optional: for Github PR view
dependencies = { 'stevearc/dressing.nvim' }
},
},
cmd = { 'Fugit2', 'Fugit2Graph' },
keys = {
{ '<leader>F', mode = 'n', '<cmd>Fugit2<cr>' }
}
},
{
-- optional: for diffview.nvim integration
'sindrets/diffview.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
-- lazy, only load diffview by these commands
cmd = {
'DiffviewFileHistory', 'DiffviewOpen', 'DiffviewToggleFiles', 'DiffviewFocusFiles', 'DiffviewRefresh'
}
}
Default options dictionary
---@class Fugit2Config
---@field width integer|string Main popup width
---@field max_width integer|string Main popup popup width when expand patch view
---@field min_width integer File view width when expand patch view
---@field content_width File view content width
---@field height integer|string Main popup height
local opts = {
width = 100,
min_width = 50,
content_width = 60,
max_width = "80%",
height = "60%",
}
TODO: add later
Trigger this view by ":Fugit2" command or by any shortcut that you assigned to.
Hot keys and usages:
Enter
: Open current file for editting.Space
: Toggle staged/unstaged of current entry.-
: Toggle staged/unstaged of current entry.s
: Stage current entry.u
: Unstage current entry.=
: Toggle patch view of current entry.x
: Discard current entry.D
: Discard current entry.j
: Move cursor to next entry.k
: Move cursor to previous entry.l
: Move cursor to patch view if visible.q
: Quit view.Esc
: Quite view.c
: Open Commit menu.b
: Open Branch menu.d
: Open Diffing menu.f
: Open Fetching menu.p
: Open Pull menu.P
: Open Push menu.N
: Open Github integration menu.
Input your commit message.
Hot keys and usages:
Esc
: Quit current commit action.q
: Quit current commit action.Enter
: Finish commit message and complete current commit action.Ctrl-c
: Quit current commit action while in insert mode.Ctrl-Enter
: Finish commit message and complete current commit action while in insert mode.
Trigger Patch view by pressing "=" in main status view, then use "h", "l" to navigate between them.
Hot keys and usages:
=
: Toggle Patch pane view.l
: Move cursor to right pane.h
: Move cursor to left pane.s
: Stage hunk or visual selection.u
: Unstage hunk or visual selection.-
: Stage if you are in Unstaged pane, Unstage if you are in Staged pane.zc
: Fold current hunk.zo
: Unfold current folded hunk.J
: Move to next hunk.K
: Move to previous hunk.
Keys and usages:
k
,j
: move up and down.yy
: copy commit id.yc
: copy commit id to clipboard.
- nvim-tiny for Github integration.
- diffview.nvim for Diffview integration.
- nui.nvim for his great Nvim UI library.
- plenary.nvim for utilities and testing framework.
- libgit2 for lightweight and performance git library.
- lazygit for Git pane inspirations.
- fugitive.vim for a great vim git client.
- magit for a great Git client.
- neogit for great Neovim git client.
- vim-flog for beautiful git graph.