https://github.com/wsdjeg/git.nvim
git.nvim is a plugin to use git command in neovim
https://github.com/wsdjeg/git.nvim
neovim-plugin
Last synced: 25 days ago
JSON representation
git.nvim is a plugin to use git command in neovim
- Host: GitHub
- URL: https://github.com/wsdjeg/git.nvim
- Owner: wsdjeg
- License: gpl-3.0
- Created: 2025-04-03T14:12:55.000Z (about 1 month ago)
- Default Branch: master
- Last Pushed: 2025-04-18T13:11:46.000Z (30 days ago)
- Last Synced: 2025-04-19T02:22:31.747Z (29 days ago)
- Topics: neovim-plugin
- Language: Lua
- Homepage:
- Size: 67.4 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# git.nvim
git.nvim is a plugin to use git command in Neovim.
* [Installation](#installation)
* [Usage](#usage)
* [Statusline](#statusline)
* [Self-Promotion](#self-promotion)
* [Feedback](#feedback)## Installation
Use your preferred Neovim plugin manager to install git.nvim.
with [nvim-plug](https://github.com/wsdjeg/nvim-plug)
```lua
require('plug').add({
{
'wsdjeg/git.nvim',
depends = {
{ 'wsdjeg/job.nvim' },
{ 'wsdjeg/notify.nvim' },
{ 'wsdjeg/logger.nvim' }, -- not strictly required
{ 'wsdjeg/rooter.nvim' }, -- not strictly required
},
},
})
```Then use `:PlugInstall git.nvim` to install this plugin.
## Usage
- `:Git add %`: stage current file.
- `:Git add .`: stage all files
- `:Git commit`: edit commit message
- `:Git push`: push to remote
- `:Git pull`: pull updates from remote
- `:Git fetch`: fetch remotes
- `:Git checkout`: checkout branches
- `:Git log %`: view git log of current file
- `:Git config`: list all git config
- `:Git reflog`: manage reflog information
- `:Git branch`: list, create, or delete branches
- `:Git rebase`: rebase git commit
- `:Git diff`: view git-diff infoThe plugin does not provide default key binding, here is an example:
```lua
vim.keymap.set('n', 'gs', 'Git status', { silent = true })
vim.keymap.set('n', 'gA', 'Git add .', { silent = true })
vim.keymap.set('n', 'gc', 'Git commit', { silent = true })
vim.keymap.set('n', 'gv', 'Git log', { silent = true })
vim.keymap.set('n', 'gV', 'Git log %', { silent = true })
vim.keymap.set('n', 'gp', 'Git push', { silent = true })
vim.keymap.set('n', 'gd', 'Git diff', { silent = true })
```## Statusline
If you want to display branch info on statusline, you can use `v:lua.require("git.command.branch").current()`, for example:
using [statusline.nvim](https://github.com/wsdjeg/statusline.nvim):
```lua
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,
},
})
```
## Self-Promotion
Like this plugin? Star the repository on
GitHub.Love this plugin? Follow [me](https://wsdjeg.net/) on
[GitHub](https://github.com/wsdjeg) and
[Twitter](http://twitter.com/wsdtty).## Feedback
If you encounter any bugs or have suggestions, please file an issue in the [issue tracker](https://github.com/wsdjeg/git.nvim/issues)