Skip to content

ashot/vim-pr-comments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

vim-pr-comments

Complete GitHub PR review workflow directly in Vim - Read, reply, and resolve PR comments without leaving your editor.

Features

πŸ” View PR Comments

  • Fetches all inline review comments from GitHub PRs
  • Displays in Vim's quickfix list for easy navigation
  • Jump directly to exact file and line locations
  • Shows comment author and full text
  • Automatically detects resolved/unresolved status

πŸ’¬ Interactive Review

  • Reply to comments - Respond directly from Vim (r key)
  • Resolve threads - Mark conversations as resolved (R key)
  • Unresolve threads - Reopen resolved conversations (U key)
  • Full GitHub PR review workflow without context switching

⚑ Performance

  • Smart caching for instant reopening
  • Separate commands for cached vs fresh data
  • Batch GraphQL queries for efficiency

🎨 Customizable Display

  • Hide resolved comments by default
  • Configurable comment truncation
  • Line wrapping options
  • Detailed preview mode

Requirements

  • Vim 8.0+ or Neovim
  • gh CLI tool installed and authenticated
  • Git repository with a GitHub remote

Installation

Using Vundle

Plugin 'ashot/vim-pr-comments'

Using vim-plug

Plug 'ashot/vim-pr-comments'

Using Pathogen

cd ~/.vim/bundle
git clone https://github.com/ashot/vim-pr-comments

Quick Start

  1. Navigate to any file in a Git repo with an open PR
  2. Run :PRCommentsOpen to load comments
  3. Use quickfix window to navigate and interact:
    • Enter - Jump to comment location
    • Space - View full comment details
    • r - Reply to comment
    • R - Resolve comment thread
    • U - Unresolve comment thread

Configuration

Add to your .vimrc:

" Maximum comment length in quickfix (default: 300 chars)
let g:pr_comments_max_length = 500

" Show full comments without truncation (default: 0)
let g:pr_comments_show_full = 1

" Enable line wrapping in quickfix window (default: 0)
let g:pr_comments_wrap_quickfix = 1

" Show resolved comments by default (default: 0 - hidden)
let g:pr_comments_show_resolved = 0

Usage

Commands

Primary Commands

  • :PRCommentsOpen - Open comments (uses cache if available)
  • :PRCommentsReload - Force refresh from GitHub
  • :PRCommentsAll - Show all comments including resolved

Additional Commands

  • :PRCommentsDebug - Show debug information
  • :PRCommentDetail - Show full comment in preview
  • :PRCommentReply - Reply to selected comment
  • :PRCommentResolve - Resolve selected thread
  • :PRCommentUnresolve - Unresolve selected thread

Default Mappings

Global

  • <leader>prc - Open PR comments (cached)
  • <leader>prr - Reload PR comments (fresh)
  • <leader>pra - Show all including resolved
  • ]c / [c - Next/previous comment
  • ]C / [C - Last/first comment

Quickfix Window

  • <CR> - Jump to location and close quickfix
  • o - Jump to location (keep quickfix open)
  • <Space> - Show full comment details
  • r - Reply to comment
  • R - Resolve comment thread
  • U - Unresolve comment thread

Workflow Example

:PRCommentsOpen          " Load PR comments
" Navigate with j/k in quickfix
<Space>                  " Read full comment
r                        " Type reply and hit enter
R                        " Mark thread as resolved
:PRCommentsReload        " Refresh after new comments
:PRCommentsAll           " Show resolved comments too

How It Works

  1. Detects current Git branch and finds associated PR
  2. Fetches comments via GitHub REST API
  3. Queries GraphQL for resolution status
  4. Populates quickfix with smart line number detection
  5. Uses GraphQL mutations for resolve/unresolve
  6. Posts replies to the correct review thread

Comment Resolution

  • Resolved comments hidden by default - Keeps focus on active discussions
  • View resolved with :PRCommentsAll
  • Resolution state from GitHub - Not based on comment text
  • Proper thread management - Resolves entire conversation thread

Tips

  • Comments are cached per session for fast access
  • Use :PRCommentsReload after new comments are added
  • Press <Space> in quickfix for full comment with code context
  • The plugin shows comment count and resolution status
  • Line numbers auto-adjust for file changes since review

Troubleshooting

"No PR found for branch"

Ensure your branch has an open PR on GitHub

"Failed to fetch PR comments"

Check gh CLI authentication:

gh auth status
gh pr view  # Should show your PR

"Cannot resolve: permission denied"

You need write access to the repository to resolve comments

Line numbers incorrect

Comments use line numbers from when they were created. If files changed significantly, positions may be approximate.

Contributing

Issues and PRs welcome at github.com/ashot/vim-pr-comments

License

MIT

About

Vim plugin to fetch and navigate GitHub PR comments in quickfix

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published