Skip to content

josephwoodward/github-browse.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Browse Neovim Extension

A small Neovim wrapper around the GitHub CLI gh browse tool to enable fast sharing links to lines, repos or commits in GitHub.

Requirements

  • A recent version of Vim or Neovim
  • The Github CLI

Installation

-- Lazy
{ 'josephwoodward/github-browse.nvim' }

Usage

The plugin defines commands that wrap the functionality of zoxide:

  • :GithubBrowse repo: Opens the current GitHub repository in your default web browser.
  • :GithubBrowse line: Opens the current line your cursor is Github using your default web browser.
  • :GithubBrowse commit: Opens given commit in GitHub in your default web browser.

Demos

Browse to Line (:GithubBrowse line)

Go to the current line in GitHub:

browse-line

Browse to Line (:GithubBrowse repo)

Load the current repository in GitHub:

browse-repo

Browse to Line (:GithubBrowse commit)

Go to the current commit in GitHub:

browse-commit

Integration with Telescope's git picker can be achived using the following snippet:

  pickers = {
    git_commits = {
      attach_mappings = function(_, map)
        map({ 'i', 'n' }, '<C-b>', function(_, _)
          local entry = require('telescope.actions.state').get_selected_entry()
          require('github-browse.browse').browse_commit { args = entry.value }
        end)

        -- needs to return true if you want to map default_mappings and
        -- false if not
        return true
      end,
    },
    ...
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published