-
Notifications
You must be signed in to change notification settings - Fork 7
📦 Installation
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
Set libgit2_path value in config options like this
{
'SuperBo/fugit2.nvim',
opts = {
libgit2_path = 'libgit2.so.1.1',
},
...
}
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
Set libgit2_path value in config options like this
{
'SuperBo/fugit2.nvim',
opts = {
libgit2_path = 'libgit2.so.1.5',
},
...
}
sudo apt-get install -y libgit2-1.7
Set libgit2_path value in config options like this
{
'SuperBo/fugit2.nvim',
opts = {
libgit2_path = 'libgit2.so.1.7',
},
...
}
sudo pacman -S libgit2
yum install libgit2
Set libgit2_path value in config options like this, change corresponding version.
{
'SuperBo/fugit2.nvim',
opts = {
libgit2_path = 'libgit2.so.1.7',
},
...
}
brew install libgit2
Set libgit2_path value in config options like this if you have problem loading libgit2 library with default settings.
Mac Arm M1/M2/M3
{
'SuperBo/fugit2.nvim',
opts = {
libgit2_path = '/opt/homebrew/lib/libgit2.dylib',
},
}
Mac Intel
{
'SuperBo/fugit2.nvim',
opts = {
libgit2_path = '/usr/local/opt/libgit2/lib/libgit2.dylib',
},
}
choco install libgit2
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
:Rocks install fugit2.nvim
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', 'Fugit2Diff', 'Fugit2Graph' },
keys = {
{ '<leader>F', mode = 'n', '<cmd>Fugit2<cr>' }
}
},
In case you want to use more stable diffview.nvim for diff split view.
{
'SuperBo/fugit2.nvim',
opts = {
width = 70,
external_diffview = true, -- tell fugit2 to use diffview.nvim instead of builtin implementation.
},
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', 'Fugit2Diff', 'Fugit2Graph' },
keys = {
{ '<leader>F', mode = 'n', '<cmd>Fugit2<cr>' }
}
},
{
'sindrets/diffview.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
-- lazy, only load diffview by these commands
cmd = {
'DiffviewFileHistory', 'DiffviewOpen', 'DiffviewToggleFiles', 'DiffviewFocusFiles', 'DiffviewRefresh'
}
}
TODO: add later
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
---@field libgit2_path string? path to libgit2 lib if not set via environments
---@field external_diffview boolean whether to use external diffview.nvim or Fugit2 implementation
local opts = {
width = 100,
min_width = 50,
content_width = 60,
max_width = "80%",
height = "60%",
external_diffview = false,
}