d6b75ac0bb
Diff buffers created by ":git diff" differ from other filetype=diff buffers in that they use "git rev-parse --show-toplevel" as root directory for diff-jump. This makes sense because paths printed by "git diff" are relative to that directory. Today we handle the above difference by making ":git" override the diff-jump mapping. This doesn't work for buffers that were read from a file. Fix this by introducing a separate filetype, "git-diff", which allows to move the mapping in the usual place. This breaks existing filetype=diff hooks[1] which need to be adapted to match git-diff (also git-log). Another motivation for the separate filetype is that a following patch wants to enable Git blame commands in git-diff buffers but not in plain diff buffers -- those should keep being blamed like any other file if tracked by Git. Perhaps git-* buffers are for Git metadata, not files that are tracked by Git. The added hooks awkwardly include their hook parameter to work around hook ordering issues when switching between filetypes. See also [2]. We could also use filetype=git-log instead of git-diff. Our highlighting for "git log --graph" would have rare false positives. Closes #5049 [1]: https://github.com/search?utf8=%E2%9C%93&q=filetype%3Ddiff+language%3Akakounescript+-repo%3Amawww%2Fkakoune+-is%3Afork&type=code [2]: https://lists.sr.ht/~mawww/kakoune/%3C20240201091907.973508-1-aclopte@gmail.com%3E |
||
---|---|---|
.. | ||
detection | ||
filetype | ||
tools | ||
windowing |