feat(conflict): add virtual text formatting and action lines (#101)
## Problem Conflict resolution virtual text only showed plain "current" / "incoming" labels with no keymap hints. Users had no way to discover available resolution keymaps without reading docs. ## Solution Default virtual text labels now include keymap hints: `(current — doo)` and `(incoming — dot)`. A new `format_virtual_text` config option lets users customize or hide labels entirely. A new `show_actions` option (off by default) renders a codelens-style action line above each `<<<<<<<` marker listing all enabled resolution keymaps. Merge diff views also gain hunk hints on `@@` header lines showing available keymaps. New config fields: `conflict.format_virtual_text` (function|nil), `conflict.show_actions` (boolean). New highlight group: `DiffsConflictActions`.
This commit is contained in:
parent
f5a090baae
commit
b5d28e9f2b
7 changed files with 347 additions and 23 deletions
|
|
@ -85,6 +85,7 @@ Configuration is done via `vim.g.diffs`. Set this before the plugin loads:
|
|||
enabled = true,
|
||||
disable_diagnostics = true,
|
||||
show_virtual_text = true,
|
||||
show_actions = false,
|
||||
keymaps = {
|
||||
ours = 'doo',
|
||||
theirs = 'dot',
|
||||
|
|
@ -416,6 +417,7 @@ Configuration: ~
|
|||
enabled = true,
|
||||
disable_diagnostics = true,
|
||||
show_virtual_text = true,
|
||||
show_actions = false,
|
||||
keymaps = {
|
||||
ours = 'doo',
|
||||
theirs = 'dot',
|
||||
|
|
@ -442,9 +444,32 @@ Configuration: ~
|
|||
diagnostics alone.
|
||||
|
||||
{show_virtual_text} (boolean, default: true)
|
||||
Show virtual text labels (" current" and
|
||||
" incoming") at the end of `<<<<<<<` and
|
||||
`>>>>>>>` marker lines.
|
||||
Show `(current)` and `(incoming)` labels at
|
||||
the end of `<<<<<<<` and `>>>>>>>` marker
|
||||
lines. Also controls hunk hints in merge
|
||||
diff views.
|
||||
|
||||
{format_virtual_text} (function|nil, default: nil)
|
||||
Custom formatter for virtual text labels.
|
||||
Receives `(side, keymap)` where `side` is
|
||||
`"ours"` or `"theirs"` and `keymap` is the
|
||||
configured keymap string or `false`. Return
|
||||
a string (label text without parens) or
|
||||
`nil` to hide the label. Example: >lua
|
||||
format_virtual_text = function(side, keymap)
|
||||
if keymap then
|
||||
return side .. ' [' .. keymap .. ']'
|
||||
end
|
||||
return side
|
||||
end
|
||||
<
|
||||
|
||||
{show_actions} (boolean, default: false)
|
||||
Show a codelens-style action line above each
|
||||
`<<<<<<<` marker listing available resolution
|
||||
keymaps. Renders as virtual lines using the
|
||||
`DiffsConflictActions` highlight group.
|
||||
Only keymaps that are not `false` appear.
|
||||
|
||||
{keymaps} (table, default: see above)
|
||||
Buffer-local keymaps for conflict resolution
|
||||
|
|
@ -687,6 +712,10 @@ Conflict highlights: ~
|
|||
*DiffsConflictBaseNr*
|
||||
DiffsConflictBaseNr Line number for base content lines (diff3).
|
||||
|
||||
*DiffsConflictActions*
|
||||
DiffsConflictActions Dimmed foreground (no bold) for the codelens-style
|
||||
action line shown when `show_actions` is true.
|
||||
|
||||
Diff mode window highlights: ~
|
||||
These are used for |winhighlight| remapping in `&diff` windows.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue