HighlightURL

December 11, 2025 ยท View on GitHub

A lightweight Neovim plugin that automatically highlights URLs in your buffers. Minimal Lua port of vim-highlighturl.

โœจ Features

  • ๐Ÿ”— Automatic URL detection and highlighting (http, https, ftp, file, ssh, git, and more)
  • โšก Performance optimized with debounced updates and cached lookups
  • ๐ŸŽจ Customizable highlight color
  • ๐Ÿ“ Filetype ignore list to skip specific buffer types
  • ๐Ÿ”’ Buffer-local disable/enable control
  • ๐ŸŒ Global toggle to quickly turn highlighting on/off

๐Ÿ“ฆ Installation

Using lazy.nvim:

{
  "rubiin/highlighturl.nvim",
  event = "VeryLazy",
  config = true,
}

Using packer.nvim:

use {
  "rubiin/highlighturl.nvim",
  config = function()
    require("highlighturl").setup()
  end
}

Using vim-plug:

call plug#begin('~/.vim/plugged')
Plug 'rubiin/highlighturl.nvim'
call plug#end()

" Configure (in your vimrc/init.vim)
lua << EOF
require('highlighturl').setup()
EOF

โš™๏ธ Configuration

The plugin works out of the box with sensible defaults. Call setup() only if you want to customize:

require("highlighturl").setup({
  -- Filetypes to skip highlighting
  ignore_filetypes = { "qf", "help", "NvimTree", "gitcommit" },

  -- URL highlight color (supports hex colors)
  highlight_color = "#5fd7ff",

  -- Debounce delay (ms) for TextChanged events (improves performance)
  debounce_ms = 100,

  -- Whether to underline URLs
  underline = true,

  -- Suppress toggle notifications
  silent = false,
})

Options

OptionTypeDefaultDescription
ignore_filetypestable{ "qf", "help", "NvimTree", "gitcommit" }List of filetypes where URL highlighting is disabled
highlight_colorstring"#5fd7ff"Hex color for highlighted URLs
debounce_msnumber100Milliseconds to wait before updating highlights after text changes
underlinebooleantrueWhether to underline URLs
silentbooleanfalseSuppress notification messages on toggle

๐ŸŽฎ Commands

CommandScopeDescription
:URLHighlightToggleGlobalToggle URL highlighting on/off for all buffers
:URLHighlightDisableBufferDisable URL highlighting for the current buffer only
:URLHighlightEnableBufferRe-enable URL highlighting for the current buffer

๐Ÿ’ป Lua API

You can also control highlighting programmatically:

local highlighturl = require("highlighturl")

-- Global toggle
highlighturl.toggle()

-- Buffer-local control
highlighturl.disable_for_buffer()      -- disable for current buffer
highlighturl.disable_for_buffer(bufnr) -- disable for specific buffer
highlighturl.enable_for_buffer()       -- re-enable for current buffer
highlighturl.enable_for_buffer(bufnr)  -- re-enable for specific buffer

-- Manual highlight refresh
highlighturl.highlight_urls()

You can also set the buffer variable directly:

vim.b.highlighturl_disabled = true  -- disable for current buffer
vim.b.highlighturl_disabled = false -- re-enable

๐Ÿ”— Supported URL Schemes

  • http://, https://
  • ftp://
  • file://
  • ssh://
  • git://
  • user@host.domain: (SCP-style)

๐Ÿ“ธ Screenshots

Before

image

After

image

๐Ÿ“„ License

MIT