- Lua 100%
| doc | custom hl groups so they can be overridden, improve docs | |
| lua | guard nvim_buf_set_extmark calls | |
| plugin | default timeout to 0, document max_bytes option | |
| LICENSE | add license | |
| README.md | custom hl groups so they can be overridden, improve docs | |
autoread-diff
Show changes when a file is reloaded after being modified externally.
The diff will be cleared when entering insert mode or when the buffer is modified.
To manually clear the diff you can use :AutoreadDiffClear.
This is not meant for full diff viewing, there are better options for that. This is for highlighting external changes to a file you're editing, for example when running a formatter, so only the new text (and the old deleted) is shown.
Options
A timeout can be set for automatically clearing the diff:
vim.g.autoread_diff_highlight_ms = 5000
When a timeout is set the diff will also be cleared on cursor movement.
Because of a Neovim limitation, the plugin holds a copy of every opened buffer, so to reduce memory impact it disables itself for files larger than 1MB.
This limit can be changed:
vim.g.autoread_diff_max_bytes = 5 * 1024 * 1024
Highlights
The highlight groups used are AudoreadDiffAdd, AutoreadDiffText, and
AutoreadDiffDelete. By default they are linked to DiffAdd, DiffText, and
DiffDelete, but you or your color scheme can override them.
Install
To install and load the plugin just add this:
vim.pack.add({"https://codeberg.org/micampe/autoread-diff.nvim"})
You don't need to call a setup function, the plugin is already set up to be loaded on demand.