Skip to content
项目

tzachar/highlight-undo.nvim

在 GitHub 查看

关于

Highlight changed text after any text changing operation

开发工具

这些数字如何统计

355 星标8 复刻 +2 24小时

实测星标增长

24小时
+2
7天
+2
15天
+2
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

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", "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:

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", "mason", "lazy" },
})

Which file types to ignore, regardless of patter.

ignore_cb

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 "".

探索相关项目

加载中…