Skip to content

Navigate from Neovim to GitHub quickly with this plugin

License

Notifications You must be signed in to change notification settings

wassimk/gh-navigator.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gh-navigator.nvim

This Neovim plugin makes jumping from coding to GitHub as painless as possible.

build release

Setup

Prerequisites

The plugin primarily acts as a wrapper for the GitHub CLI (gh), and also makes a few direct git calls. So ensure the gh tool is installed and can connect to your GitHub account.

Here are instructions for macOS users:

  1. Install gh and connect it to your GitHub account.
brew install gh
gh auth login
  1. If gh is already installed, check it's working with:
gh auth status

Installation

Install gh-navigator via your preferred plugin manager. The following example uses lazy.nvim.

{
  'wassimk/gh-navigator.nvim',
  version = "*",
  config = true
}

Important

This plugin is actively developed on the main branch. I recommend using versioned releases with the version key to avoid unexpected breaking changes.

Usage

GH is the main command, but it accepts different sub-commands:

GH Command

Move the cursor over a commit SHA, PR number, or search term and run the GH command to open it on GitHub. The term under the cursor will be used as the argument.

Sub-Commands

Sub-Command Description
GH blame Opens the current file in GitHub's blame view.
GH browse Opens the current file in GitHub's blob view.
GH pr <arg> Opens a PR based on a commit SHA, PR number, or search term (e.g., GH pr 1234, GH pr c2d25b3, or GH pr refactor the actor class).
GH repo <path> Opens a certain path in the current repo on GitHub (e.g., GH repo issues opens the repo's issues page). Auto-completion is available for paths such as issues, pulls, actions, releases, etc.

Note

Both GH browse and GH blame can accept a range. For instance, in visual mode (V), select a set of lines and run GH blame to open the blame view for that selection.