gi/README.md

71 lines
2.3 KiB
Markdown

# jj-mini.diff
A Neovim plugin to provide `mini.diff`-like functionality for Jujutsu (`jj`) repositories, with a focus on displaying Git signs for changes.
## Features
* **Jujutsu Git Signs:** Visually indicate added, modified, and deleted lines directly in your Neovim buffer, reflecting changes in your `jj` working copy.
* **Seamless Integration:** Designed to integrate smoothly with Neovim's existing `diff` capabilities and user interface.
## Installation
You can install `jj-mini.diff` using your favorite Neovim plugin manager.
**lazy.nvim:**
```lua
{
"your-github-username/jj-mini.diff", -- Replace with the actual repository path
config = function()
require("jj_mini_diff").setup({
-- Your configuration options here
})
end,
}
```
## Usage
To activate the plugin, call the `setup()` function in your Neovim configuration:
```lua
require("jj_mini_diff").setup({
-- Optional: Customize signs or autocmd events
-- signs = {
-- add = { text = "++", texthl = "DiffAdd", numhl = "DiffAdd" },
-- change = { text = "//", texthl = "DiffChange", numhl = "DiffChange" },
-- delete = { text = "--", texthl = "DiffDelete", numhl = "DiffDelete" },
-- },
-- autocmd_events = { "BufReadPost", "BufWritePost", "CursorHold", "InsertLeave" },
})
```
The plugin will automatically place and update signs in files within a Jujutsu repository on `BufReadPost`, `BufWritePost`, and `CursorHold` events by default.
You can also manually refresh the signs for the current buffer at any time:
```lua
:lua require("jj_mini_diff").refresh_signs()
```
## Configuration
The `setup()` function accepts an optional table for configuration.
```lua
require("jj_mini_diff").setup({
signs = {
add = { text = "│", texthl = "JjDiffAdd", numhl = "JjDiffAdd" },
change = { text = "│", texthl = "JjDiffChange", numhl = "JjDiffChange" },
delete = { text = "─", texthl = "JjDiffDelete", numhl = "JjDiffDelete" },
},
autocmd_events = { "BufReadPost", "BufWritePost", "CursorHold" },
})
```
* **`signs`**: A table to customize the text, text highlight group (`texthl`), and number highlight group (`numhl`) for each sign type.
* `add`: For added lines.
* `change`: For changed lines.
* `delete`: For deleted lines.
* **`autocmd_events`**: A list of Neovim autocommand events that will trigger a sign refresh.