Giter Site home page Giter Site logo

git.nvim's Introduction

git.nvim

git.nvim is the simple clone of the plugin vim-fugitive which is written in Lua.

Install

vim plug

Plug 'dinhhuy258/git.nvim'

packer.nvim

use {
  'dinhhuy258/git.nvim'
}

Requirements

  • Neovim >= 0.5.0
  • git

Features

  • Run git command in Neovim with :Git. Eg: :Git 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
  • Works correctly with winbar enabled (or plugins making use of winbar, like barbecue.nvim)

For more information please refer this file

Usage

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",
  -- Private gitlab hosts, if you use a private gitlab, put your private gitlab host here
  private_gitlabs = { "https://xxx.git.com" },
  -- Enable winbar in all windows created by this plugin
  winbar = false,
})

Command

:Git run git command in terminal

Eg: :Git checkout -b test

:GitBlame opens git blame window

:GitDiff 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 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

Issues

  • Some features may not work on window so pull request are welcome

Credits

git.nvim's People

Contributors

dinhhuy258 avatar alienover avatar huypersonio avatar arafune avatar frantisekstanko avatar eric-hansen avatar gstokkink avatar mario-amazing avatar paco0x avatar ecerulm avatar seruman avatar yota-k avatar mizuho1998 avatar shrianshchari avatar sunfuze avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.