git.nvim is the simple clone of the plugin vim-fugitive which is written in Lua.
Plug 'dinhhuy258/git.nvim'
use 'dinhhuy258/git.nvim',
- Neovim >= 0.5.0
- git
- Run git command in Neovim with
:Git
or:G
. Eg::Git status
or:G status
- Open git blame window, press enter on a line to view the commit where the line changed
- Open git browse, open pull request, create pull request in Github and Gitlab
- Git diff
- Git revert
For more information please refer this file
For the basic setup with default configurations
require('git').setup()
Configuration can be passed to the setup function. Here is an example with most of the default settings:
require('git').setup({
default_mappings = true, -- NOTE: `quit_blame` and `blame_commit` are still merged to the keymaps even if `default_mappings = false`
keymaps = {
-- Open blame window
blame = "<Leader>gb",
-- Close blame window
quit_blame = "q",
-- Open blame commit
blame_commit = "<CR>",
-- Open file/folder in git repository
browse = "<Leader>go",
-- Open pull request of the current branch
open_pull_request = "<Leader>gp",
-- Create a pull request with the target branch is set in the `target_branch` option
create_pull_request = "<Leader>gn",
-- Opens a new diff that compares against the current index
diff = "<Leader>gd",
-- Close git diff
diff_close = "<Leader>gD",
-- Revert to the specific commit
revert = "<Leader>gr",
-- Revert the current file to the specific commit
revert_file = "<Leader>gR",
},
-- Default target branch when create a pull request
target_branch = "master",
})
:Git
or :G
run git command in terminal
Eg:
:Git checkout -b test
OR :G checkout -b test
:GitDiff
or :GDiff
opens a new diff that compares against the current index. You can also provide any valid git rev to the command. Eg: :GitDiff HEAD~2
:GitDiffClose
or :GDiffClose
close the git diff window
:GitCreatePullRequest
create pull request in git repository, the default target branch is set in the target_branch
option. If you provide the branch then the default target_branch
will be ignored
Eg:
:GitCreatePullRequest
:GitCreatePullRequest test_branch
:GitRevert
revert to specific commit
:GitRevertFile
revert the current file to specific commit
- Some features may not work on window so pull request are welcome