A Neovim plugin that shows Jujutsu (jj) diff information in the gutter, similar to how gitsigns.nvim works for Git.
- Gutter Signs: Shows
┃,▁,▔,~signs in the sign column for added, changed, and deleted lines (same as gitsigns) - Line Highlighting: Optional highlighting of modified lines
- Number Column: Optional highlighting of line numbers for modified lines
- Real-time Updates: Updates signs as you type (with debouncing for performance)
- Auto-attach: Automatically attaches to files in JJ repositories
- Customizable: Configurable signs, colors, and behavior
- Neovim 0.9+
- Jujutsu (jj) executable in your PATH
Using lazy.nvim
{
'your-username/jjsigns.nvim',
config = function()
require('jjsigns').setup()
end
}Using packer.nvim
use {
'your-username/jjsigns.nvim',
config = function()
require('jjsigns').setup()
end
}require('jjsigns').setup({
enabled = true,
attach = {
auto = true, -- Auto-attach to JJ repository files
},
signs = {
add = { text = '┃', numhl = 'JjSignsAddNr', linehl = 'JjSignsAddLn' },
change = { text = '┃', numhl = 'JjSignsChangeNr', linehl = 'JjSignsChangeLn' },
delete = { text = '▁', numhl = 'JjSignsDeleteNr', linehl = 'JjSignsDeleteLn' },
topdelete = { text = '▔', numhl = 'JjSignsDeleteNr', linehl = 'JjSignsDeleteLn' },
changedelete = { text = '~', numhl = 'JjSignsChangeNr', linehl = 'JjSignsChangeLn' },
},
sign_priority = 6,
signcolumn = true, -- Toggle with `:JjSigns toggle_signs`
numhl = false, -- Toggle with `:JjSigns toggle_numhl`
linehl = false, -- Toggle with `:JjSigns toggle_linehl`
-- JJ specific options
base = '@-', -- Base revision to compare against (default: parent revision)
-- Performance options
update_debounce = 100, -- Debounce time for updates in milliseconds
}):JjSigns setup- Setup/reinitialize the plugin:JjSigns toggle- Toggle the plugin on/off:JjSigns enable- Enable the plugin:JjSigns disable- Disable the plugin
The plugin defines the following highlight groups:
JjSignsAdd- Added lines signJjSignsChange- Changed lines signJjSignsDelete- Deleted lines signJjSignsTopdelete- Top deleted lines signJjSignsChangedelete- Changed+deleted lines sign
JjSignsAddNr- Added lines numberJjSignsChangeNr- Changed lines numberJjSignsDeleteNr- Deleted lines numberJjSignsTopdeletNr- Top deleted lines numberJjSignsChangedeletefNr- Changed+deleted lines number
JjSignsAddLn- Added lines backgroundJjSignsChangeLn- Changed lines backgroundJjSignsDeleteLn- Deleted lines backgroundJjSignsTopdeleteLn- Top deleted lines backgroundJjSignsChangedeleteLn- Changed+deleted lines background
By default, these link to the corresponding GitSigns* highlight groups if available, providing consistent styling with gitsigns.nvim.
- The plugin automatically detects JJ repositories when you open files
- For tracked files, it runs
jj diffto compare the working copy with the parent revision (@-) - It parses the diff output to identify added, changed, and deleted lines
- Signs are placed in the gutter using Neovim's extmarks API
- Signs are updated in real-time as you edit files, with debouncing for performance
The plugin compares your working copy files against the base revision (default @-, the parent revision). This is equivalent to running:
jj diff --git --context=0 -r @-..@ -- path/to/fileYou can change the base revision in the configuration if you want to compare against a different revision.
- Uses debouncing (100ms by default) to avoid excessive updates while typing
- Only processes files that are tracked in the JJ repository
- Automatically detaches from buffers when they're unloaded
- Minimal memory footprint by storing only essential state
- Ensure
jjis in your PATH::!jj version - Check if you're in a JJ repository:
:!jj status - Verify the file is tracked:
:!jj file list path/to/file - Check if the plugin is enabled:
:JjSigns toggle
- Increase
update_debouncein the configuration - Disable
linehlornumhlif not needed
Contributions are welcome! Please feel free to submit issues and pull requests.
The codebase uses StyLua for formatting. To format the code:
# Install stylua (if not already installed)
cargo install stylua
# Format all Lua files
stylua --config-path stylua.toml lua/ plugin/ *.luaMIT License - see LICENSE file for details.
- Inspired by gitsigns.nvim
- Built for Jujutsu VCS