Extend Neovim's gx to open anything under your cursor!
Features β’ Installation β’ Configuration β’ Documentation
gx-extended.nvim supercharges Neovim's built-in gx command. Press gx on anything β package names, import statements, issue numbers, commit hashes, and more β and it opens the right URL in your browser.
Before: gx only worked on URLs
After: gx works on 20+ different patterns across all your files!
- π 19 built-in handlers β npm, cargo, docker, terraform, git, and more
- π― Deterministic ordering β Predictable priority system (first defined = first checked)
- π 4 optional power features β NPM imports, GitHub permalinks, Jira, Linear
- π§ Zero config needed β Works out of the box
- π¨ Fully extensible β Add your own patterns easily
- π 900+ lines of docs β Examples for everything
- β‘ Lightweight β Heavy features are opt-in
Press gx on any of these:
import express from "express" // β Opens npmjs.comserde = "1.0" // β Opens crates.ioFROM nginx:alpine // β Opens hub.docker.comFixed CVE-2024-1234 // β Opens nvd.nist.gov
See commit a1b2c3d // β Opens GitHub commit
Visit docs.github.com // β Opens with https://π¦ Package Managers (7 supported)
| Language | File | Example | Opens |
|---|---|---|---|
| JavaScript/TypeScript | package.json |
"express": "^4.18.2" |
npmjs.com |
| Rust | Cargo.toml |
serde = "1.0" |
crates.io |
| Go | go.mod |
github.com/gin-gonic/gin |
pkg.go.dev |
| Python | requirements.txt |
django>=4.0 |
pypi.org |
| Ruby | Gemfile |
gem "rails" |
rubygems.org |
| Homebrew | Brewfile |
brew "neovim" |
formulae.brew.sh |
| Docker | Dockerfile |
FROM nginx |
hub.docker.com |
βοΈ Infrastructure & DevOps
- Terraform (
*.tf) β AWS/GCP resource documentationresource "aws_instance"β Terraform Registry
- Docker β Official images and user repositories
FROM nginx:alpineβ Docker HubFROM user/image:tagβ Docker Hub
π Git & Version Control
- Git Commits β Opens on GitHub/GitLab/Bitbucket
a1b2c3dβ commit page (auto-detects remote)
- GitHub Permalinks β (optional) β Share exact code locations
- Press
gxon any line βgithub.com/repo/file.ts#L42
- Press
π Documentation & References
- Markdown Links β
[text](url)β Opens URL - CVE References β
CVE-2024-1234β NVD database - Python PEPs β
PEP 8β Python Enhancement Proposals - URLs without protocol β
google.comβhttps://google.com
π Neovim Plugins
- Works with Packer, Lazy.nvim, vim-plug
'user/plugin'β Opens GitHub repository
π Optional Power Features
Enable these for even more power:
| Feature | What it does | Enable with |
|---|---|---|
| NPM Imports | import axios from "axios" β npm |
enable_npm_imports = true |
| GitHub Permalinks | Any line β GitHub link with line number | enable_github_file_line = true |
| Jira Tickets | PROJ-123 β Your Jira |
vim.g.gx_jira_url |
| Linear Issues | ENG-456 β Your Linear |
vim.g.gx_linear_team |
π See ADVANCED.md for complete optional features guide β
lazy.nvim (recommended)
{
'rmagatti/gx-extended.nvim',
keys = { 'gx' },
config = function()
require('gx-extended').setup {}
end
}use {
'rmagatti/gx-extended.nvim',
config = function()
require('gx-extended').setup {}
end
}Plug 'rmagatti/gx-extended.nvim'Then in your init.lua:
require('gx-extended').setup {}require('gx-extended').setup {}That's it! All built-in features work out of the box.
require('gx-extended').setup {
-- Optional: NPM imports in JS/TS files
enable_npm_imports = true,
-- Optional: GitHub file line permalinks
enable_github_file_line = true,
-- Optional: Custom browser
open_fn = require('lazy.util').open,
}require('gx-extended').setup {
extensions = {
{
patterns = { "*" },
name = "Jira Tickets",
match_to_url = function(line_string)
local ticket = string.match(line_string, "([A-Z]+-[0-9]+)")
if ticket then
return "https://yourcompany.atlassian.net/browse/" .. ticket
end
end,
},
},
}π See full configuration guide β
- Move cursor over a pattern (package name, URL, commit hash, etc.)
- Press
gxin normal mode - Opens in your browser!
Also works in visual mode β Select text and press gx
When multiple handlers match, you get a menu:
Multiple patterns matched. Select one:
> Docker Hub
Git Commit
No-protocol URLs
Use ββ to select, Enter to open.
We've made testing easy! Try it out:
cd ~/.local/share/nvim/lazy/gx-extended.nvim/test-samples
./test-runner.shOr manually test any feature:
nvim package.json
# Move cursor to "express" and press gxπ See complete testing guide β
| Document | What's inside |
|---|---|
| ADVANCED.md | Optional features, custom extensions, power-user configs (600+ lines) |
| EXAMPLES.md | Real-world examples for every feature (400+ lines) |
| TESTING.md | Complete testing guide with test files (540+ lines) |
Contributions are welcome!
- π‘ Have an idea? Open an issue
- π Found a bug? Report it
- π§ Want to add a feature? Submit a PR!
See ADVANCED.md for examples of custom extensions. We're always open to adding more built-in handlers!
Extensions are checked in registration order:
- File-specific handlers (package.json, Cargo.toml, etc.)
- Markdown handlers
- Git handlers
- Reference handlers (CVE, PEP)
- Fallback handlers (no-protocol URLs)
- Your custom extensions
First match wins! If multiple match, you get a menu.
Key improvement: Extensions are checked in the exact order they're registered. No more random behavior!
This means:
- Predictable β Same pattern always wins
- Configurable β Control priority by registration order
- Debuggable β Easy to understand what's happening
Example: File-specific handlers are registered first, so they always take priority over generic patterns.
- 19 total extensions (15 built-in + 4 optional)
- 7 package managers supported
- 3 git platforms (GitHub, GitLab, Bitbucket)
- 20+ file types covered
- 900+ lines of documentation
- Zero dependencies (besides Neovim 0.5+)
- stsewd/gx-extended.vim β The original gx-extended for Vim
- chrishrb/gx.nvim β Another excellent Neovim implementation
MIT License - see LICENSE for details