🐙 GithubUtils.nvim - simple utils for working with Github inside Neovim.
- Neovim (tested with 0.9.0)
- telescope.nvim
- git
- Github CLI
Via lazy.nvim:
require('lazy').setup({
-- Github Integration
{ 'mistweaverco/githubutils.nvim', dependencies = 'nvim-telescope/telescope.nvim' },
})
Opens up the Github Web-IDE with the current line pre-selected (on the current branch).
Can be used from visual mode when passing { v = true }
(require('githubutils').open({ v = true })
) which will then pre-select
the visually selected lines (on the current branch).
NOTE: additionally commit = true
can be passed which will open the current commit,
rather than the current branch.
Opens up the base Github page of the current git repository you're in.
Prompts you for a commit hash and opens up the Github web-view of this commit.
If you leave the prompt empty and press enter, the Github web-view of all commits for the current branch will be opened.
Lists all open pull-requests. Takes you to the web-view of the pull-request selected.
Lists all open issues. Takes you to the web-view of the issue selected.
Takes you to the web-view of the actions.
Lists all labels. Takes you to the web-view of the label selected.
With which-key.nvim:
-- Mappings for normal mode
wk.register({
g = {
name = "Goto",
h = {
name = "Github Utils",
o = { "<Cmd>lua require('githubutils').open()<CR>", "Open" },
O = { "<Cmd>lua require('githubutils').open({ commit = true })<CR>", "Open commit" },
r = { "<Cmd>lua require('githubutils').repo()<CR>", "Repo" },
c = { "<Cmd>lua require('githubutils').commit()<CR>", "Commit" },
p = { "<Cmd>lua require('githubutils').pulls()<CR>", "Pulls" },
i = { "<Cmd>lua require('githubutils').issues()<CR>", "Issues" },
a = { "<Cmd>lua require('githubutils').actions()<CR>", "Actions" },
l = { "<Cmd>lua require('githubutils').labels()<CR>", "Actions" },
},
},
}, { prefix = "<leader>" })
-- Mappings for visual mode
wk.register({
g = {
name = "Goto",
h = {
name = "Github Utils",
o = { "<Cmd>lua require('githubutils').open({ v = true })<CR>", "Open" },
O = { "<Cmd>lua require('githubutils').open({ v = true, commit = true })<CR>", "Open commit" },
},
},
}, { prefix = "<leader>", mode = "v" })