docs: add fugitive status buffer keymaps documentation
Document the du/dU keymaps for unified diffs in vim-fugitive status buffers, including behavior by file status and configuration options.
This commit is contained in:
parent
b5ec99fd06
commit
d8332895f3
2 changed files with 58 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ syntax highlighting.
|
||||||
- Diff header highlighting (`diff --git`, `index`, `---`, `+++`)
|
- Diff header highlighting (`diff --git`, `index`, `---`, `+++`)
|
||||||
- `:Gdiffsplit` / `:Gvdiffsplit` syntax through diff backgrounds
|
- `:Gdiffsplit` / `:Gvdiffsplit` syntax through diff backgrounds
|
||||||
- `:Gdiff` unified diff against any git revision with syntax highlighting
|
- `:Gdiff` unified diff against any git revision with syntax highlighting
|
||||||
|
- Fugitive status buffer keymaps (`du`/`dU`) for unified diffs
|
||||||
- Background-only diff colors for any `&diff` buffer (`:diffthis`, `vimdiff`)
|
- Background-only diff colors for any `&diff` buffer (`:diffthis`, `vimdiff`)
|
||||||
- Vim syntax fallback for languages without a treesitter parser
|
- Vim syntax fallback for languages without a treesitter parser
|
||||||
- Hunk header context highlighting (`@@ ... @@ function foo()`)
|
- Hunk header context highlighting (`@@ ... @@ function foo()`)
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,10 @@ Configuration is done via `vim.g.diffs`. Set this before the plugin loads:
|
||||||
max_lines = 200,
|
max_lines = 200,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
fugitive = {
|
||||||
|
horizontal = 'du',
|
||||||
|
vertical = 'dU',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
<
|
<
|
||||||
*diffs.Config*
|
*diffs.Config*
|
||||||
|
|
@ -89,6 +93,10 @@ Configuration is done via `vim.g.diffs`. Set this before the plugin loads:
|
||||||
Controls which highlight features are enabled.
|
Controls which highlight features are enabled.
|
||||||
See |diffs.Highlights| for fields.
|
See |diffs.Highlights| for fields.
|
||||||
|
|
||||||
|
{fugitive} (table, default: see below)
|
||||||
|
Fugitive status buffer keymap options.
|
||||||
|
See |diffs.FugitiveConfig| for fields.
|
||||||
|
|
||||||
*diffs.Highlights*
|
*diffs.Highlights*
|
||||||
Highlights table fields: ~
|
Highlights table fields: ~
|
||||||
{background} (boolean, default: true)
|
{background} (boolean, default: true)
|
||||||
|
|
@ -168,6 +176,55 @@ COMMANDS *diffs-commands*
|
||||||
:Ghdiff [revision] *:Ghdiff*
|
:Ghdiff [revision] *:Ghdiff*
|
||||||
Like |:Gdiff| but explicitly opens in a horizontal split.
|
Like |:Gdiff| but explicitly opens in a horizontal split.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
FUGITIVE STATUS KEYMAPS *diffs-fugitive*
|
||||||
|
|
||||||
|
When inside a vim-fugitive |:Git| status buffer, diffs.nvim provides keymaps
|
||||||
|
to open unified diffs for files or entire sections.
|
||||||
|
|
||||||
|
Keymaps: ~
|
||||||
|
*diffs-du* *diffs-dU*
|
||||||
|
du Open unified diff in a horizontal split.
|
||||||
|
dU Open unified diff in a vertical split.
|
||||||
|
|
||||||
|
These keymaps work on:
|
||||||
|
- File lines (e.g., `M src/foo.lua`) - opens diff for that file
|
||||||
|
- Section headers (e.g., `Staged (3)`) - opens diff for all files in section
|
||||||
|
- Hunk/context lines below a file - opens diff for the parent file
|
||||||
|
|
||||||
|
Behavior by file status: ~
|
||||||
|
|
||||||
|
Status Section Base Current Result ~
|
||||||
|
M Unstaged index working tree unstaged changes
|
||||||
|
M Staged HEAD index staged changes
|
||||||
|
A Staged (empty) index file as all-added
|
||||||
|
D Staged HEAD (empty) file as all-removed
|
||||||
|
R Staged HEAD:oldname index:newname content diff
|
||||||
|
? Untracked (empty) working tree file as all-added
|
||||||
|
|
||||||
|
On section headers, the keymap runs `git diff` (or `git diff --cached` for
|
||||||
|
staged) and displays all changes in that section as a single unified diff.
|
||||||
|
Untracked section headers show a warning since there is no meaningful diff.
|
||||||
|
|
||||||
|
Configuration: ~
|
||||||
|
*diffs.FugitiveConfig*
|
||||||
|
>lua
|
||||||
|
vim.g.diffs = {
|
||||||
|
fugitive = {
|
||||||
|
horizontal = 'du', -- keymap for horizontal split, false to disable
|
||||||
|
vertical = 'dU', -- keymap for vertical split, false to disable
|
||||||
|
},
|
||||||
|
}
|
||||||
|
<
|
||||||
|
Fields: ~
|
||||||
|
{horizontal} (string|false, default: 'du')
|
||||||
|
Keymap for unified diff in horizontal split.
|
||||||
|
Set to `false` to disable.
|
||||||
|
|
||||||
|
{vertical} (string|false, default: 'dU')
|
||||||
|
Keymap for unified diff in vertical split.
|
||||||
|
Set to `false` to disable.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
API *diffs-api*
|
API *diffs-api*
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue