Code Monkey home page Code Monkey logo

ghpr-blame.vim's Introduction

Blaming Pull Requests in the file on Vim

ghpr-blame.vim is a Vim plugin to investigate which line is modified by which pull request. It's like git-blame, but git-blame shows which line is modified by which commit.

screenshot

This Vim plugin was inspired by @kazuho's tiny script.

Usage

1. Run :GHPRBlame in the file

By running :GHPRBlame, it extract necessary information from git-blame command and creates a list in a temporary window at left of current window. The temporary window is automatically scrolled when you scroll the current window (see :help scrollbind for the detail).

You can know which line is modified by which pull request by seeing the list.

2. Type enter key to know the details of the pull request

When :GHPRBlame, it automatically defines a buffer local mapping for inspecting the pull request for the current line. If you want to know the details of the current line, please type <CR> (it can be customized by g:ghpr_show_pr_mapping). It creates another temporary window and show the detail of the pull request in it.

3. Close the list window or run :GHPRBlameQuit for cleanup

After your work has been done, please close the list window for pull requests or run :GHPRBlameQuit explicitly. It cleans up the cache for fetching pull requests and git-blame.

Setup API Token

To fetch the details of pull request, this plugin uses GitHub PullRequest API. It may hit API rate limit when using this plugin heavily.

Please generate and set an API token by below steps.

  1. Visit https://github.com/settings/tokens in a browser
  2. Click 'Generate new token'
  3. Add token description
  4. Without checking any checkbox, click 'Generate token'
  5. Generated token is shown at the top of your tokens list
  6. Set it to g:ghpr_github_auth_token (Please be careful. The token is a credential)

for GitHub Enterprise

You should also prepare the token to access. It should be different from the github.com's one, so you can supply them by a dict form of g:ghpr_github_auth_token.

let g:ghpr_github_auth_token = {
        \ 'github.com': '123456abcdef',
        \ 'github.your-company.com': 'abcdef123456',
        \ }

In addition, you should set the API url for GHE by g:ghpr_github_api_url.

let g:ghpr_github_api_url = {
        \ 'github.your-company.com': 'https://github.your-company.com/api/v3',
        \ }

License

the MIT License

Copyright (c) 2017 rhysd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ghpr-blame.vim's People

Contributors

calorie avatar mattn avatar oshow avatar rhysd avatar unasuke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ghpr-blame.vim's Issues

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.