Browse Neovim runtime files on GitHub directly from your editor.
Kapture.2025-05-14.at.16.33.07.mp4
rtbrowse.nvim is a Neovim plugin that lets you open the corresponding GitHub source page for any Neovim runtime file and line(s) directly from your editor. It is useful for exploring Neovim's source code, referencing documentation, or sharing links to specific lines.
If you use this plugin on files that are not Neovim runtime files, it fallbacks to another action (default: Snacks.gitbrowse()
). So you can use this plugin without worrying about the file you are viewing.
Use your favorite plugin manager. Example for lazy.nvim:
-- You need no `opts = {}`
{ "delphinus/rtbrowse.nvim" }
Or, setup with full configuration. See doc for the detail.
{
"delphinus/rtbrowse.nvim",
-- You may use this plugin with keymaps.
keys = {
{
"<Leader>gB",
function() require("rtbrowse").browse() end,
mode = { "n", "x", "o" },
},
},
-- full configuration options
opts = {
fallback = function()
-- custom fallback action
end,
get_commit = "curl", -- or "gh"
},
}
To open the current runtime file on GitHub:
:lua require("rtbrowse").browse()
- If you have a visual selection, the selected lines will be highlighted in the GitHub link.
- If not, the current line will be used.
Example key mappings:
nnoremap <Leader>gB :lua require("rtbrowse").browse()<CR>
vnoremap <Leader>gB :lua require("rtbrowse").browse()<CR>
If the file is not a Neovim runtime file, a fallback action is triggered.