bf239ba77a
git-diff-goto-source is specific to diffs produced by Git. This patch generalizes the logic and moves it to a new diff-jump in diff.kak. The main differences are: - diff-jump handles plain file diffs (i.e. without the -r option). These have no "diff" line. This means that it needs to parse +++/--- instead. - diff-jump can go to the old file, not just the new one. - diff-jump allows to override the base directory and the number of directory components to strip. git-diff-goto-source was implemented with several nested try/catch blocks. Implementing the extra features would have added more nesting, redundancy or hidden options. To avoid that, I ported the parsing logic to Perl (which git.kak already depends on). Maybe it's possible to do the same in awk. Potential concerns: - We could move diff-jump to a new rc/tools/diff.kak but then it's not obvious where the "diff" module belongs to. - Should diff "diff-jump -1" be spelled "diff-jump -p1"? In future, the diff parser could be reused to implement a vimdiff-style feature: given a diff and the "old" line number, we can compute the corresponding "new" line number. Perhaps diff-jump should get a -client argument. |
||
---|---|---|
.. | ||
detection | ||
filetype | ||
tools | ||
windowing |