Skip to content

justinmk/guh.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

261 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

guh.nvim

Note

This plugin is pretty sweet, but still WIP/beta. PRs/feedback welcome!

Work with GitHub PRs in Neovim. Wraps the GitHub gh CLI with a minimalist yet effective workflow.

Guh is ~2k lines of code, leveraging builtin Nvim mechanisms such as diagnostics and 'scrollbind' buffers, and otherwise delegating to the gh CLI.

Usage

Run :Guh to see status.

:Guh

Run :Guh 42 to view PR/issue 42. Also accepts a GitHub URL, owner/repo#123 slug, or commit-id (SHA):

:Guh 35951
:Guh a1b2c3d
:Guh https://github.com/neovim/neovim/pull/35951
:Guh neovim/neovim#35951
:Guh guh://neovim/neovim/pr/35951
:Guh https://github.com/neovim/neovim/commit/a1b2c3d

Inside any guh:// buffer, press <CR> to run :Guh on the target at cursor.

Editable buffers (comments, merge message) confirm the action on write-and-close:

  • :wq (or ZZ) submits.
  • :q! (or ZQ) discards.

See help file for details.

Install

vim.pack.add{ 'https://github.com/justinmk/guh.nvim' }

See help for default config.

Requirements:

How it works

  1. Shows gh output in a :terminal buffer.
  2. Sets global <Plug>(guh-…) keymaps. Provides default buffer-local mappings if you don't set any mappings to the <Plug> mappings.
  3. :Guh is the main entrypoint. It shows status, or views a given item (PR, issue).
  4. Presents PR diff comments:
    • in a 'scrollbind' split window
    • as "diagnostics" (vim.diagnostic), loaded in quickfix
  5. Loads most-recent CI logs for all "jobs" in the CI matrix.
  6. (TODO) Fetch the git data into .git (without doing a checkout).
  7. (TODO) When viewing the diff, user can navigate to the git object (file) without doing a checkout.
  8. (TODO) PR comments will display on relevant local git objects.

Development

Run the tests:

NEOVIM_PATH='/path/to/neovim/' make test

Run specific tests:

NEOVIM_PATH='/path/to/neovim/' make test TEST_FILTER=load_comments

Related

Credits

guh.nvim was originally forked (and completely rewritten) from https://github.com/daliusd/ghlite.nvim by Dalius Dobravolskas.

About

Work with GitHub in Neovim

Resources

License

Stars

Watchers

Forks

Contributors