feat(forge): add gx keymap to open forge links in browser (#165)

Problem: Forge shorthand tokens like `gh:user/repo#42` are concealed in
the buffer so Neovim's built-in `gx` cannot recognize them as URLs.
Full URLs are also concealed, making `gx` unreliable.

Solution: Add `open_link` action (default `gx`) that reads `forge_spans`
from line metadata. If the cursor is on a forge token, that link opens;
otherwise the last ref on the line is used. Delegates to `vim.ui.open()`.
This commit is contained in:
Barrett Ruth 2026-03-15 11:08:07 -04:00 committed by GitHub
parent f3ef1ca0db
commit 093e699413
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 42 additions and 0 deletions

View file

@ -349,6 +349,7 @@ Default buffer-local keys: ~
`gb` Toggle blocked status (`blocked`)
`g/` Toggle cancelled status (`cancelled`)
`ge` Open markdown detail buffer for task notes (`edit_notes`)
`gx` Open the forge link under the cursor in a browser (`open_link`)
`gf` Prompt for filter predicates (`filter`)
`<Tab>` Switch between category / queue view (`view`)
`gz` Undo the last `:w` save (`undo`)
@ -494,6 +495,13 @@ old keys to `false`: >lua
Shows a read-only metadata header and editable notes below a `---`
separator. Press `q` to return to the task list. Default key: `ge`.
*<Plug>(pending-open-link)*
<Plug>(pending-open-link)
Open the forge link under the cursor in a browser via |vim.ui.open()|.
If the cursor is positioned on a forge token (`gh:user/repo#42` or a
full URL), that link is opened. Otherwise, the last forge reference on
the line is used. No-op on lines without forge links. Default key: `gx`.
*<Plug>(pending-open-line)*
<Plug>(pending-open-line)
Insert a correctly-formatted blank task line below the cursor.