Skip to content

Highlight changed text after any text changing operation

License

Notifications You must be signed in to change notification settings

maor-orchid/highlight-undo.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

highlight-undo.nvim

Highlight changed text after any action not in insert mode which modifies the current buffer. This plugin was originaly written to support Undo / Redo highlighting, but is now expanded to support any other action.

Purely lua / nvim api implementation, no external dependencies needed.

In Action

recording

Installation

Using Lazy:

  {
    'tzachar/highlight-undo.nvim',
    opts = {
        hlgroup = "HighlightUndo",
        duration = 300,
        pattern = {"*"},
        ignored_filetypes = { "neo-tree", "fugitive", " TelescopePrompt" },
        ignore_cb = nil,
    },
  },

Setup

The easiest way to set up highlight-undo as follows:

require('highlight-undo').setup({})

hlgroup

require('highlight-undo').setup({
    hlgroup = "HighlightUndo"
})

Specify the highlighting group to use. By default, highlight-undo will use HighlightUndo.

duration

require('highlight-undo').setup({
    duration = 300
})

The duration (in milliseconds) to highlight changes. Default is 300.

pattern

require('highlight-undo').setup({
    pattern = {"*"},
})

Which file patterns to atttach to. Default is everything (*).

ignored_filetypes

require('highlight-undo').setup({
        ignored_filetypes = { "neo-tree", "fugitive", " TelescopePrompt" },
})

Which file types to ignore, regardless of patter.

ignore_cb

require('highlight-undo').setup({
        ignored_cb = function(buf) return false end,
})

You can also provide a callback function which is called when attaching to a new buffer, which should return true if you want to disable highlight-undo on this buffer.

About

Highlight changed text after any text changing operation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Lua 100.0%