From ddcca1077d23b5972c6023f6569e590bf65dcfe0 Mon Sep 17 00:00:00 2001 From: themodrnhakr Date: Thu, 2 Oct 2025 16:15:01 -0500 Subject: [PATCH] Update README.md with installation, usage, and configuration details --- README.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c7202d1..1c580f6 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,62 @@ A Neovim plugin to provide `mini.diff`-like functionality for Jujutsu (`jj`) rep ## Installation -(TODO: Provide installation instructions using popular Neovim plugin managers like `packer.nvim`, `lazy.nvim`, or `vim-plug`.) +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 -(TODO: Explain how to activate and use the plugin, including any commands or keybindings.) +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 -(TODO: Document available configuration options for customizing signs, colors, and behavior.) +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. \ No newline at end of file