jannotate.nvim
A neovim plugin to view `jujutsu file annotate` next to your code.
⧇ source
⧉ mirror
Installation
lazy.nvim
require('lazy').setup({
'https://git.sr.ht/~rbdr/jannotate.nvim',
})
By default, jannotate adds keymaps that might not suit your style, or conflict with other plugins. You can customize, disable, or extend them with the `keymaps` option.
Here's the full configuration with its default values:
require('lazy').setup({
{
'git@git.sr.ht:~rbdr/jannotate.nvim',
opts = {
-- Whether or not to highlight lines in the same change
highlight_related = true,
-- Default display mode for commit details.
-- `float`: shows a floating window you can quit with q or <ESC>
-- `vertical-split` and `horizontal-split`: split your current buffer.
-- `replace`: replaces your current buffer.
default_show_display_mode = 'float',
-- Keymaps configuration
-- If not specified, defaults are used
-- User keymaps merge with defaults (add to or override)
-- Set a key to `false` to disable a default keymap
-- Set to {} to disable all keymaps
keymaps = {
['<space>a'] = 'toggle-annotations', -- Global: toggle annotate sidebar
['<CR>'] = 'show.annotate', -- Annotate buffer: show commit details
['gs'] = 'show.source', -- Source buffer: show commit details
}
}
}
})
Keymaps
Unless disabled, these are the key bindings provided:
- `<space>a`, `:Jannotate` - Open the annotate sidebar.
- `gs` *(in source file, when annotate is open)* - Show details for the change at the cursor.
- `<CR>` *(in annotate sidebar)* - Show details for the change at the cursor.
- `q` *(in commit details buffer)* - Close the commit details view.
The `keymaps` configuration option allows you to customize keymaps. your
keymaps here **merge with defaults**, so you can add new bindings without
losing the default ones. If you want to disable a keymap, set it to `false`.
Available Actions
- toggle-annotations - Toggle the annotate sidebar (global action)
- show.annotate - Show commit details from annotate buffer
- show.source - Show commit details from source buffer
Examples
-- Add a new keymap while keeping defaults
opts = {
keymaps = {
['<leader>ja'] = 'toggle-annotations', -- Adds a new binding, keeps <space>a
}
}
-- Disable a specific default keymap
opts = {
keymaps = {
['<CR>'] = false, -- Disables <CR> in annotate buffer
}
}
-- Use one key for multiple contexts
opts = {
keymaps = {
['K'] = {'show.annotate', 'show.source'}, -- K works in both buffers
}
}
-- Replace defaults with your own
opts = {
keymaps = {
['<space>a'] = false, -- Disable default
['<leader>a'] = 'toggle-annotations', -- Use your own key
}
}