Skip to content

A Neovim plugin that colorizes multiple search terms with multiple distinct colors for better visual tracking.

Notifications You must be signed in to change notification settings

hamidi-dev/kaleidosearch.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Kaleidosearch.nvim

A Neovim plugin that colorizes multiple search terms with multiple distinct colors for better visual tracking.

kaleidosearch.mp4

Features

  • Highlight multiple search terms with different colors
  • Navigate between matches using standard search commands (n/N)
  • Add words incrementally without losing existing highlights
  • Add word under cursor with a single keymap AND remove it (toggle)
  • Add visual selection to highlights
  • dot-repeatable: Hit . at any point and the colors will change

Installation

Using your favorite plugin manager:

lazy.nvim

{
  "hamidi-dev/kaleidosearch.nvim",
  dependencies = {
    "tpope/vim-repeat",       -- optional for dot-repeatability
    "stevearc/dressing.nvim", -- optional for nice input
  },

  config = function()
    require("kaleidosearch").setup({
      -- optional configuration
    })
  end,
}

packer.nvim

use {
  'hamidi-dev/kaleidosearch.nvim',
  requires = {
    'tpope/vim-repeat',       -- optional for dot-repeatability
    'stevearc/dressing.nvim', -- optional for nice input
  },
  config = function()
    require('kaleidosearch').setup({
      -- optional configuration
    })
  end
}

Usage

CommandDescription
:Kaleidosearch word1 word2Highlight specified words with colors
:KaleidosearchClearClear all highlighted words
:KaleidosearchAddWordAdd a new word to existing highlights
:KaleidosearchAddCursorWordAdd word under cursor to existing highlights

Default Keymaps

KeymapAction
<leader>csOpen prompt for words to colorize
<leader>ccClear all highlighted words (reset to clean slate)
<leader>cnAdd a new word to existing highlights
<leader>caAdd word under cursor to existing highlights

Configuration

require("kaleidosearch").setup({
  highlight_group_prefix = "WordColor_", -- Prefix for highlight groups
  case_sensitive = false,                -- Case sensitivity for matching
  whole_word_match = false,              -- Only match whole words, not substrings
  keymaps = {
    enabled = true,                      -- Set to false to disable default keymaps
    open = "<leader>cs",                 -- Open input prompt for search
    clear = "<leader>cc",                -- Clear highlights (reset to clean slate)
    add_new_word = "<leader>cn",         -- Add a new word to existing highlights
    add_cursor_word = "<leader>ca",      -- Add word under cursor to highlights OR current visual selection
    opts = {
      noremap = true,
      silent = true,
    }
  }
})

Development

Running Tests

This plugin includes unit tests using Plenary.nvim. To run the tests:

  1. Use the provided script (it will install Plenary.nvim if needed):
./scripts/run_tests.sh
  1. Or if you’re inside Neovim with Plenary installed:
:PlenaryBustedDirectory test/ {minimal_init = 'test/minimal_init.lua'}

Misc.

  • PRs welcome 😃
  • Ideas / issues welcome

License

MIT License

About

A Neovim plugin that colorizes multiple search terms with multiple distinct colors for better visual tracking.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published