axieax/urlview.nvim

github github
utility
stars 235
issues 3
subscribers 2
forks 6
CREATED

2022-01-30

UPDATED

7 months ago


✨ UrlView is an extensible plugin for the Neovim text editor which essentially:

  1. Finds URLs from a variety of search contexts (e.g. from a buffer, file, plugin URLs)
  2. Displays these URLs in a picker, such as the built-in vim.ui.select or telescope.nvim
  3. Performs actions on selected URLs, such as navigating to the URL in your preferred browser, or copying the link to your clipboard

🎯 Additional features and example use cases include:

  • Easily visualise all the URLs in a buffer or file (e.g. links in your Markdown documents)
  • Quickly accessing repo webpages for installed Neovim plugins (life-saver for config updates or browsing plugin documentation)
  • Ability to register custom searchers (e.g. Jira ticket numbers), pickers and actions (please see docs or :h urlview.search-custom)
  • Jumping to the previous or next URL in the active buffer (and opening the URL 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

buffer-demo

πŸ”Œ Plugin Links

:UrlView lazy, :UrlView packer, or :UrlView vimplug depending on your plugin manager of choice

packer-demo

⚑ Requirements

  • This plugin supports Neovim v0.7 or later.
  • Please find the appropriate *-compat Git tag if you need legacy support for previous Neovim versions, such as v0.6-compat for nvim v0.6, although these versions will no longer receive any new updates or features.
  • For Neovim versions prior to v0.6 or Vanilla Vim support, please check out urlview.vim as an alternative plugin.

πŸš€ Usage

Searching contexts

  1. Use the command :UrlView to see all the URLs in the current buffer.
  • For your convenience, feel free to setup a keybind for this using vim.keymap.set:

    vim.keymap.set("n", "\\u", "<Cmd>UrlView<CR>", { desc = "View buffer URLs" })
    vim.keymap.set("n", "\\U", "<Cmd>UrlView packer<CR>", { desc = "View Packer plugin URLs" })
    
  • 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
  1. You can optionally select a link to bring it up in your browser.

Buffer URL navigation

  1. You can use [u and ]u (default bindings) to jump to the previous and next URL in the buffer respectively.
  2. If desired, you can now press gx to open the URL under the cursor in your browser, with netrw.
  3. This keymap can be altered under the jump config option.

πŸ“¦ Installation

Install this plugin with your package manager of choice. You can lazy load this plugin by the UrlView command if desired.

use("axieax/urlview.nvim")
"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 options using the setup function:

require("urlview").setup({
  -- custom configuration options --
})

Please check out the documentation for configuration options and details.

🎨 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 images above, I used dressing.nvim's Telescope option, which allows me to further filter and fuzzy search through my entries.

πŸ”­ Telescope

  • Optional picker option
  • Additional requirements (only if you're using this picker): telescope.nvim
  • You can use Telescope as your default_picker using the require("urlview").setup function
  • Alternatively, you can specify a picker dynamically with :UrlView <ctx> picker=telescope

🚧 Stay Updated

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 :)

It is recommended to subscribe to the πŸ™‰ Breaking Changes thread to be updated on potentially breaking changes to this plugin, as well as resolution strategies.