https://github.com/tzachar/highlight-undo.nvim
Highlight changed text after any text changing operation
https://github.com/tzachar/highlight-undo.nvim
lua neovim neovim-plugin
Last synced: 3 months ago
JSON representation
Highlight changed text after any text changing operation
- Host: GitHub
- URL: https://github.com/tzachar/highlight-undo.nvim
- Owner: tzachar
- License: apache-2.0
- Created: 2023-06-08T09:39:22.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-13T07:25:29.000Z (5 months ago)
- Last Synced: 2025-02-13T08:27:01.056Z (5 months ago)
- Topics: lua, neovim, neovim-plugin
- Language: Lua
- Homepage:
- Size: 30.3 KB
- Stars: 318
- Watchers: 6
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- my-neovim-pluginlist - tzachar/highlight-undo.nvim - undo.nvim)   (Other Standard Feature Enhancement / Undo)
- stars - tzachar/highlight-undo.nvim - Highlight changed text after any text changing operation (Lua)
README
# 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

## Installation
Using Lazy:
```lua
{
'tzachar/highlight-undo.nvim',
opts = {
hlgroup = "HighlightUndo",
duration = 300,
pattern = {"*"},
ignored_filetypes = { "neo-tree", "fugitive", "TelescopePrompt", "mason", "lazy" },
-- ignore_cb is in comma as there is a default implementation. Setting
-- to nil will mean no default os called.
-- ignore_cb = nil,
},
},
```## Setup
The easiest way to set up `highlight-undo` as follows:
```lua
require('highlight-undo').setup({})
```## `hlgroup`
```lua
require('highlight-undo').setup({
hlgroup = "HighlightUndo"
})
```Specify the highlighting group to use. By default, `highlight-undo` will use `HighlightUndo`.
## `duration`
```lua
require('highlight-undo').setup({
duration = 300
})
```The duration (in milliseconds) to highlight changes. Default is 300.
## `pattern`
```lua
require('highlight-undo').setup({
pattern = {"*"},
})
```Which file patterns to atttach to. Default is everything (`*`).
## `ignored_filetypes`
```lua
require('highlight-undo').setup({
ignored_filetypes = { "neo-tree", "fugitive", "TelescopePrompt", "mason", "lazy" },
})
```Which file types to ignore, regardless of `patter`.
## `ignore_cb`
```lua
require('highlight-undo').setup({
ignore_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.
The default callback rejects nomodifiable buffers and bufers whose file type is
`""`.