A small Neovim wrapper around the GitHub CLI gh browse
tool to enable fast sharing links to lines, repos or commits in GitHub.
- A recent version of Vim or Neovim
- The Github CLI
-- Lazy
{ 'josephwoodward/github-browse.nvim' }
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.
Go to the current line in GitHub:
Load the current repository in GitHub:
Go to the current commit in GitHub:
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,
},
...
}