urlview.nvim
urlview.nvim copied to clipboard
π Neovim plugin for viewing all the URLs in a buffer
π urlview.nvim
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.
πΈ Screenshots
π Buffer Links
:UrlView
or :UrlView buffer
π Plugin Links
:UrlView packer
or :UrlView vimplug
depending on your plugin manager of choice
β‘ Requirements
This plugin requires Neovim 0.6+. If necessary, please check out Alternatives for other similar plugins supporting versions prior to 0.6.
π Usage
- Use the command
:UrlView
to see all the URLs in the current buffer.
- For your convenience, feel free to set a keybind for this using
vim.api.nvim_set_keymap
- You can also hit
:UrlView <tab>
to see additional contexts that you can search from- e.g.
:UrlView packer
to view links for installed packer.nvim plugins
- e.g.
- You can optionally select a link to bring it up in your browser.
π¦ Installation
Free free to install this plugin manually or with your favourite plugin manager. As an example, using packer.nvim:
use("axieax/urlview.nvim")
βοΈ Configuration
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.
-- By default, this is "netrw", or "system" if netrw is disabled
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",
},
},
})
π¨ Pickers
βοΈ Native (vim.ui.select)
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.
π Telescope
- Additional requirements: telescope.nvim
- You can use Telescope as your
default_picker
using therequire("urlview").setup
function - Alternatively, you can specify a picker dynamically with
:UrlView <ctx> picker=telescope
- If you really want access to
:Telescope urlview
, then add the following line to your config:
require("telescope").load_extension("urlview")
ποΈ Alternatives
π§ Extras
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 :)