Skip to content

rubiin/highlighturl.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

58 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

HighlightURL

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

Option Type Default Description
ignore_filetypes table { "qf", "help", "NvimTree", "gitcommit" } List of filetypes where URL highlighting is disabled
highlight_color string "#5fd7ff" Hex color for highlighted URLs
debounce_ms number 100 Milliseconds to wait before updating highlights after text changes
underline boolean true Whether to underline URLs
silent boolean false Suppress notification messages on toggle

๐ŸŽฎ Commands

Command Scope Description
:URLHighlightToggle Global Toggle URL highlighting on/off for all buffers
:URLHighlightDisable Buffer Disable URL highlighting for the current buffer only
:URLHighlightEnable Buffer Re-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

About

Highlight all url in buffer

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 2

  •  
  •  

Languages