*forge.nvim.txt* Forge-agnostic git workflow for Neovim Author: Barrett Ruth License: MIT ============================================================================== INTRODUCTION *forge.nvim* forge.nvim provides PR, issue, and CI workflows across GitHub, GitLab, and Codeberg from inside Neovim. It detects the forge from your git remote and delegates to the appropriate CLI (`gh`, `glab`, or `tea`). Features: ~ - Forge detection from git remote URL - PR lifecycle (list, create, checkout, review, merge, approve, draft toggle) - Issue management (list, browse, close/reopen) - CI/CD run viewing, log streaming, status filtering - PR compose buffer with diff stat and template discovery - Code review via diffs.nvim with unified/split toggle - Commit and branch browsing with forge permalinks - Worktree creation from PRs - fzf-lua pickers with contextual keybinds ============================================================================== CONTENTS *forge-contents* 1. Introduction ............................................... |forge.nvim| 2. Requirements ....................................... |forge-requirements| 3. Setup ..................................................... |forge-setup| 4. Configuration ............................................ |forge-config| 5. Forge Picker ............................................ |forge-picker| 6. Pull Requests ................................................. |forge-pr| 7. Issues .................................................. |forge-issues| 8. CI/CD ...................................................... |forge-ci| 9. Commits ............................................... |forge-commits| 10. Branches .............................................. |forge-branches| 11. Review ................................................ |forge-review| 12. Compose Buffer ........................................ |forge-compose| 13. Highlight Groups .................................... |forge-highlights| 14. Health Check ............................................ |forge-health| ============================================================================== REQUIREMENTS *forge-requirements* - Neovim 0.10.0+ - fzf-lua (required) - One or more forge CLIs: - `gh` for GitHub - `glab` for GitLab - `tea` for Codeberg/Gitea/Forgejo - vim-fugitive (optional, for fugitive keymaps) - diffs.nvim (optional, for review mode) ============================================================================== SETUP *forge-setup* Install with lazy.nvim: >lua { 'barrettruth/forge.nvim', keys = { { '', mode = { 'n', 'v' } }, }, } < Run `:checkhealth forge` to verify CLIs and dependencies. ============================================================================== CONFIGURATION *forge-config* Configuration is done via `vim.g.forge`: >lua vim.g.forge = { ci = { lines = 10000 }, } < *forge-config-ci-lines* ci.lines ~ Number of log lines to fetch for CI runs. Default: `10000`. ============================================================================== FORGE PICKER *forge-picker* ** Press `` in normal or visual mode to open the main forge picker. The picker adapts based on the detected forge and current buffer state. Available entries: ~ - Pull Requests / Merge Requests - Issues - CI / Pipelines - Browse Remote - Open File (current file on remote) - Yank Commit URL / Yank Branch URL - Commits - Branches - Worktrees ============================================================================== PULL REQUESTS *forge-pr* The PR picker lists open PRs by default. Toggle state with `` to cycle through open/closed/all. PR picker keybinds: ~ `` Checkout PR branch `` Review diff (requires diffs.nvim) `` Create worktree from PR `` View checks/CI status `` Open in browser `` Manage (merge, approve, close, draft toggle) `` Create new PR `` Toggle state filter (open/closed/all) `` Refresh list PR management actions: ~ Approve, Merge (per available method), Close/Reopen, Draft toggle. ============================================================================== ISSUES *forge-issues* Issue picker keybinds: ~ `` Open in browser `` Close/reopen issue `` Toggle state filter `` Refresh list ============================================================================== CI/CD *forge-ci* CI picker shows workflow runs for the current branch. CI picker keybinds: ~ `` View logs (tail for in-progress, full for completed) `` Open in browser `` Refresh Checks picker (from PR): ~ `` View check logs `` Open in browser `` Filter to failed `` Filter to passed `` Filter to running `` Show all ============================================================================== COMMITS *forge-commits* Commit picker keybinds: ~ `` Checkout commit (detached HEAD) `` Review diff `` Open in browser (requires forge) `` Yank commit hash ============================================================================== BRANCHES *forge-branches* Branch picker keybinds: ~ `` Review diff against branch `` Open branch on remote (requires forge) ============================================================================== REVIEW *forge-review* Review mode requires diffs.nvim. Enter review via `` on a PR or commit. Review keybinds: ~ `s` Toggle unified/split view `]q` / `[q` Next/previous quickfix entry (file navigation) `]l` / `[l` Next/previous loclist entry Review mode ends automatically when the review buffer is wiped. ============================================================================== COMPOSE BUFFER *forge-compose* Creating a PR opens a compose buffer (`forge://pr/new`) with: - Line 1: PR title (pre-filled from commit subject or branch name) - Line 3+: PR body (pre-filled from commit body or PR template) - HTML comment block: metadata (branch info, draft, reviewers, diff stat) The compose buffer is `filetype=markdown` with `buftype=acwrite`. Write the buffer (`:w`) to push and create the PR. An empty title or body aborts. Metadata fields (editable in the comment block): ~ `Draft:` Set to `yes` or `true` to create as draft `Reviewers:` Comma-separated list of reviewer usernames Template discovery: ~ forge.nvim searches for PR templates in the repository: - `.github/pull_request_template.md` - `.github/PULL_REQUEST_TEMPLATE/` (single file auto-selected, multiple prompts for choice) - GitLab/Codeberg equivalents Fugitive keymaps: ~ From a fugitive buffer, the following keymaps are available: `cpr` Create PR `cpd` Create draft PR `cpf` Create PR instantly (skip compose buffer) `cpw` Create PR via web browser ============================================================================== HIGHLIGHT GROUPS *forge-highlights* The compose buffer uses the following highlight groups: `ForgeComposeComment` Entire comment block Links to `Comment` `ForgeComposeBranch` Branch names Links to `Special` `ForgeComposeForge` Forge name Links to `Type` `ForgeComposeDraft` Draft status value Links to `DiagnosticWarn` `ForgeComposeFile` File paths in diff stat Links to `Directory` `ForgeComposeAdded` Addition indicators (+) Links to `Added` `ForgeComposeRemoved` Deletion indicators (-) Links to `Removed` All groups are defined with `default = true` so colorschemes can override them. ============================================================================== HEALTH CHECK *forge-health* Run `:checkhealth forge` to verify: - git is available - Forge CLIs (`gh`, `glab`, `tea`) and their status - fzf-lua is installed - diffs.nvim is available (for review mode) - vim-fugitive is available (for fugitive keymaps) ============================================================================== vim:tw=78:ts=8:ft=help:norl: