UrlView is a Neovim plugin which displays links from a variety of contexts (e.g. from a buffer, file, packer.nvim and vim-plug plugin URLs), using the built-in vim.ui.select
or telescope.nvim as a picker. These entries can also be selected to be brought up in your browser.
Please note that currently, this plugin only detects URLs beginning with a HTTP(s) or www prefix for buffer and file search, but there are plans to support a more general pattern, see πΊοΈ Roadmap.
:UrlView
or :UrlView buffer
:UrlView packer
or :UrlView vimplug
depending on your plugin manager of choice
This plugin requires Neovim 0.6+. If necessary, please check out Alternatives for other similar plugins supporting versions prior to 0.6.
:UrlView
to see all the URLs in the current buffer.vim.api.nvim_set_keymap
:UrlView <tab>
to see additional contexts that you can search from:UrlView packer
to view links for installed packer.nvim pluginsFree free to install this plugin manually or with your favourite plugin manager. As an example, using packer.nvim:
use("axieax/urlview.nvim")
This plugin supports plug-n-play, meaning you can get it up and running without any additional setup.
However, you can customise the default behaviour using the setup
function:
require("urlview").setup({
-- Prompt title (`<context> <default_title>`, e.g. `Buffer Links:`)
default_title = "Links:",
-- Default picker to display links with
-- Options: "native" (vim.ui.select) or "telescope"
default_picker = "native",
-- Set the default protocol for us to prefix URLs with if they don't start with http/https
default_prefix = "https://",
-- Command or method to open links with
-- Options: "netrw", "system" (default OS browser); or "firefox", "chromium" etc.
navigate_method = "netrw",
-- Ensure links shown in the picker are unique (no duplicates)
unique = true,
-- Ensure links shown in the picker are sorted alphabetically
sorted = true,
-- Logs user warnings (recommended for error detection)
debug = true,
-- Custom search captures
-- NOTE: captures follow Lua pattern matching (https://riptutorial.com/lua/example/20315/lua-pattern-matching)
custom_searches = {
-- KEY: search source name
-- VALUE: custom search function or table (map with keys capture, format)
jira = {
capture = "AXIE%-%d+",
format = "https://jira.axieax.com/browse/%s",
},
},
})
You can customise the appearance of vim.ui.select
with plugins such as dressing.nvim and telescope-ui-select.nvim. In the demo above, I used dressing.nvim's Telescope option, which allows me to further filter and fuzzy search through my entries.
default_picker
using the require("urlview").setup
function:UrlView <ctx> picker=telescope
:Telescope urlview
, then add the following line to your config:require("telescope").load_extension("urlview")
More features are continually being added to this plugin (see πΊοΈ Roadmap). Feel free to file an issue or create a PR for any features / fixes :)