kakoune/rc/tools
Johannes Altmanninger 86d940c225 rc tools git: command for easy recursive blaming
Our ":git blame" annotates each line with the most recent commit.
However often a line has been modified by several commits.

Introduce ":git blame-jump" which shows the commit that added the
line at cursor. Crucially, it works also in Git diff buffers, so it
can be used recursively to find the full history of a line.

To do the recursive blame from a diff, I need to navigate to the
old (deleted) version of a line. Since old and new line are usually
neighbors. Speed up the common scenario of finding the old version
by making ":git blame-jump" jump to the new version. This means the
initial diff view might not include the commit message etc. Compensate
this by showing the commit's date+author+subject in the status line.

Here are some test cases.
- run blame-jump after "git blame"
- create an uncommitted or unsaved line, run "git blame" and
  "blame-jump" on the uncommitted line
- run blame-jump without running "git blame"
- run blame-jump in "git show"
- run blame-jump in "git diff HEAD"
- run blame-jump in "git diff --cached"
- run blame-jump in "git diff" (YMMV if there are cached changes,
  could fix that)

Naming: there are some similar commands in the wild [1];
they are usually called "show-blamed" or similar, but they
don't jump to the corresponding line.  Also our list of git
commands is getting a bit messy (especially the undocumented
show-diff/hide-diff/next-hunk/prev-hunk; subject first naming seems
better).

[1]: f6e78ec4c0/kakrc (L423)

Future work: to go back to the previously-blamed commit we need to
have had the foresight to use "rename-buffer". Perhaps we want to
add some kind of buffer stack (like Magit does for example).
2024-02-05 21:42:02 +11:00
..
go Adjust regex in gopls-def for when filepath contains a dash 2022-11-15 10:10:24 +01:00
python Fix jedi off-by-one and refactor jedi 2021-05-04 20:57:13 +02:00
rust simplify rust completion to match generic Kakoune completions 2019-05-17 20:00:40 +03:00
autorestore.asciidoc Update plugin docs to not duplicate docstring information. 2020-09-03 17:18:19 +10:00
autorestore.kak rc autorestore: fix regression due to ! breaking change 2022-04-28 19:32:24 +02:00
autowrap.kak Make x just select the full lines 2022-07-05 08:43:40 +10:00
clang.kak Move user mappings to <space> and keep/remove selection to , 2022-07-05 08:43:40 +10:00
comment.kak Update Pony language support 2024-01-11 23:46:14 +03:00
ctags.kak Remove sorting of tags results 2024-01-17 21:18:22 +11:00
doc.asciidoc Wrapped the lines at the 80th column 2022-05-06 10:33:12 -07:00
doc.kak ranked match: prefer input order over alphabetical order for user-specified completions 2023-12-02 10:43:59 +01:00
format.kak rc format: restore in-client error when formatcmd fails 2022-04-09 15:36:02 +02:00
git.kak rc tools git: command for easy recursive blaming 2024-02-05 21:42:02 +11:00
grep.kak rc grep: include stderr in grep buffer 2023-11-12 11:59:11 +01:00
lint.asciidoc Reference content goes in docstrings, explanations go in prose docs. 2020-09-04 19:20:50 +10:00
lint.kak Fix #3957 2021-07-09 22:18:25 -03:00
make.kak rc/make.kak reuse make_error_pattern 2023-11-02 09:11:18 +08:00
man.kak rc tools ctags/man: rationalize sorting of completion candidates 2024-01-13 17:24:03 +01:00
menu.kak rc tools menu: add -on-abort switch 2023-11-20 20:47:22 +01:00
patch-range.pl rc tools patch: skip patch message signature, fixing diff application 2024-01-26 09:55:52 +11:00
patch.kak rc tools patch: figure out path to patch-range.pl without double-parsing 2024-02-01 20:41:01 +11:00
spell.kak fix a sed error on mac 2023-09-05 14:48:26 +08:00