feat(conflict): add virtual text formatting and action lines
Problem: conflict resolution virtual text only showed plain "current" /
"incoming" labels with no keymap hints, and users had no way to
discover available keymaps without reading docs.
Solution: add keymap hints to default labels ("current — doo"), expose
format_virtual_text config for custom label formatting, and add
show_actions option for codelens-style action lines above conflict
markers. Also add hunk hints in merge diff views.
This commit is contained in:
parent
a2053a132b
commit
6e1a053bc4
6 changed files with 375 additions and 11 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,35 @@ Configuration: ~
|
|||
diagnostics alone.
|
||||
|
||||
{show_virtual_text} (boolean, default: true)
|
||||
Show virtual text labels (" current" and
|
||||
" incoming") at the end of `<<<<<<<` and
|
||||
`>>>>>>>` marker lines.
|
||||
Show virtual text labels at the end of
|
||||
`<<<<<<<` and `>>>>>>>` marker lines.
|
||||
Default labels include keymap hints:
|
||||
`(current — doo)` and `(incoming — dot)`.
|
||||
If a keymap is `false`, the hint is omitted.
|
||||
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 +715,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