Skip to content

🌟 Highlight yanked, pasted, and undone/redone text in Neovim with a splash of color.

License

Notifications You must be signed in to change notification settings

mei28/luminate.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

37 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

luminate.nvim

🌟 Highlight yanked, pasted, and undone/redone text in Neovim with a splash of color.

luminate

πŸ“¦ Installation

Using lazy.nvim:

return {
    'mei28/luminate.nvim',
    event = { 'VeryLazy' },
    config = function()
        require'luminate'.setup({
            -- if you want to customize, see Usage!
        })
    end
}

πŸ”§ Usage

Simply call the setup function in your Neovim configuration:

require'luminate'.setup({
  duration = 500,                     -- Duration of the highlight in milliseconds. Default is 500.
  yank = {
    hlgroup = "LuminateYank",         -- Highlight group for yanked text. Default is "LuminateYank".
    guibg = "#2d4f67",                -- Background color for GUIs. Default is "#2d4f67".
    fg = "#ebcb8b",                   -- Foreground color. Default is "#ebcb8b".
    enabled = true,                   -- Enable highlight on yank. Default is true.
  },
  paste = {
    hlgroup = "LuminatePaste",        -- Highlight group for pasted text. Default is "LuminatePaste".
    guibg = "#2d4f67",                -- Background color for GUIs. Default is "#2d4f67".
    fg = "#ebcb8b",                   -- Foreground color. Default is "#ebcb8b".
    enabled = true,                   -- Enable highlight on paste. Default is true.
    mode = 'n',                       -- Mode in which to map paste. Default is 'n' (normal mode).
    lhs = { 'p', 'P' },               -- Keybindings for paste. Default is {'p', 'P'}.
    map = { p = 'p', P = 'P' },       -- Commands to execute for paste.
    opts = {},                        -- Options for keymap. Default is {}.
  },
  undo = {
    hlgroup = "LuminateUndo",         -- Highlight group for undo. Default is "LuminateUndo".
    guibg = "#2d4f67",                -- Background color for GUIs. Default is "#2d4f67".
    fg = "#ebcb8b",                   -- Foreground color. Default is "#ebcb8b".
    enabled = true,                   -- Enable highlight on undo. Default is true.
    mode = 'n',                       -- Mode in which to map undo. Default is 'n' (normal mode).
    lhs = { 'u', 'U' },               -- Keybindings for undo. Default is {'u', 'U'}.
    map = { u = 'u', U = 'U' },       -- Commands to execute for undo.
    opts = {},                        -- Options for keymap. Default is {}.
    enabled = true,                   -- Enable highlight on undo. Default is true.
  },
  redo = {
    hlgroup = "LuminateRedo",         -- Highlight group for redo. Default is "LuminateRedo".
    guibg = "#2d4f67",                -- Background color for GUIs. Default is "#2d4f67".
    fg = "#ebcb8b",                   -- Foreground color. Default is "#ebcb8b".
    enabled = true,                   -- Enable highlight on redo. Default is true.
    mode = 'n',                       -- Mode in which to map redo. Default is 'n' (normal mode).
    lhs = { '<C-r>' },                -- Keybinding for redo. Default is {'<C-r>'}.
    map = '<C-r>',                    -- Command to execute for redo. Default is 'redo'.
    opts = {},                        -- Options for keymap. Default is {}.
    enabled = true,                   -- Enable highlight on redo. Default is true.
  },
  highlight_for_count = true,         -- Highlight for count in undo/redo. Default is true.
})

✨ Customizing

Custom Color:

If you'd like to use a custom color, you can define your own highlight group in Vimscript:

highlight MyYankGroup ctermbg=red guibg=#FF0000

Then, specify the custom group in the setup function:

require'luminate'.setup({
  yank = {
    hlgroup = "MyYankGroup",
    guibg = "#FF0000",
    fg = "red",
  }
})

Enable/Disable Features:

require'luminate'.setup({
  yank = {
    enabled = false,          -- Disable highlight on yank.
  },
  paste = {
    enabled = true,           -- Enable highlight on paste.
  },
  undo = {
    enabled = true,           -- Enable highlight on undo.
  },
  redo = {
    enabled = true,           -- Enable highlight on redo.
  }
})

βš™οΈ Configuration Options

  • duration: Time in milliseconds for the highlight to last.
  • yank: Configuration for yank highlight.
    • hlgroup: The highlight group to use for yank.
    • guibg: Background color for GUIs.
    • fg: Foreground color.
    • enabled: Enable or disable yank highlight.
  • paste: Configuration for paste highlight.
    • hlgroup: The highlight group to use for paste.
    • guibg: Background color for GUIs.
    • fg: Foreground color.
    • enabled: Enable or disable paste highlight.
    • mode: Mode in which to map paste.
    • lhs: Keybindings for paste.
    • map: Commands to execute for paste.
    • opts: Options for keymap.
  • undo: Configuration for undo highlight.
    • hlgroup: The highlight group to use for undo.
    • guibg: Background color for GUIs.
    • fg: Foreground color. <<<<<<< HEAD =======
    • HIGHLIGHT_THRESHOLD: Skip highlight if undone text exceeds this fraction of total lines.
    • enabled: Enable or disable paste highlight.

origin * mode: Mode in which to map undo. * lhs: Keybinding for undo. * map: Command to execute for undo. * opts: Options for keymap. * enabled: Enable or disable undo highlight.

  • redo: Configuration for redo highlight.
    • hlgroup: The highlight group to use for redo.
    • guibg: Background color for GUIs.
    • fg: Foreground color. <<<<<<< HEAD =======
    • HIGHLIGHT_THRESHOLD: Skip highlight if redone text exceeds this fraction of total lines.
    • enabled: Enable or disable paste highlight.

origin * mode: Mode in which to map redo. * lhs: Keybinding for redo. * map: Command to execute for redo. * opts: Options for keymap. * enabled: Enable or disable redo highlight.

  • highlight_for_count: Highlight for count in undo/redo.

πŸ“œ License

MIT

πŸ’‘ Inspiration

This plugin was inspired by highlight-undo.nvim.

About

🌟 Highlight yanked, pasted, and undone/redone text in Neovim with a splash of color.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages