sponsor Vim development Vim logo Vim Book Ad

open-browser-github.vim : Open GitHub URL of file, issue, pull request (GitHub Enterprise supported)

 script karma  Rating 4/1, Downloaded by 1193  Comments, bugs, improvements  Vim wiki

created by
tyru
 
script type
utility
 
description
Requirements

  This plugin requires:
  * open-browser.vim
  * git command in your PATH

Usage

  There are 4 commands.

  :OpenGithubFile
    Opens a specific file in github.com repository(it also opens in the current branch by default).

    " Opens current files URL in github.com
    :OpenGithubFile
    " Opens current files highlighted place in github.com
    :'<,'>OpenGithubFile
    " Opens a specific file in github.com
    :OpenGithubFile PATH/TO/FILE

  :OpenGithubIssue
    Opens a specific Issue.

    " Opens current repositories Issue #1
    :OpenGithubIssue 1
    " Opens a specific repositories Issue #1
    :OpenGithubIssue 1 tyru/open-browser.vim
    " Opens current repositories Issue List
    :OpenGithubIssue
    " Opens a specific repositories Issue list
    :OpenGithubIssue tyru/open-browser.vim

  :OpenGithubPullReq
    This command opens /pulls page when it has no argument. Otherwise, it does entirely the same thing as :OpenGithubIssue since GitHub redirects /issues/1 to /pull/1 if #1 is a Pull Request.

  :OpenGithubProject
    Opens a project page.

    " Opens current opening file's repository.
    " ex) https://{hostname}/{user}/{name}
    :OpenGithubProject

    " Opens current opening file's repository.
    " ex) https://{hostname}/tyru/open-browser.vim
    :OpenGithubProject tyru/open-browser.vim

GitHub Enterprise setting

  If you have hub command in your PATH, openbrowser-github executes the following command:

    hub browse -u -- {path}

  And it will open the returned (output) URL.

  If you don't have hub command in your PATH, openbrowser-github tries to get each part of URL from the following gitconfig key:

    * hub.host

  You can specify GitHub Enterprise repository URL by setting above keys in gitconfig.

  For example, you can set hub.host by executing the following command in your git repository which you want to specify GitHub Enterprise repository URL.

    git config --local hub.host my.git.org

Latest source
  https://github.com/tyru/open-browser-github.vim
 
install details
...
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
open-browser-github-v1.0.1.zip v1.0.1 2018-03-24 7.4 tyru [Fix] Fix undefined variable when openbrowser's global variable is not defined at startup (#27)
open-browser-github-v1.0.0.zip v1.0.0 2018-03-11 7.4 tyru Initial upload
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github