helix-git
See what used to be there: show the HEAD version of the current change or the whole file.
- Stars: 0
- Last commit:
- Created:
See what used to be there: show the HEAD version of the current change or the whole file.
See what used to be there — right inside Helix.
Helix's diff gutter already tells you where a line was added, changed or deleted since the last commit. helix-git answers the next question: what was there before? Press a key on a gutter marker and the previous version of that hunk pops up, just like LSP hover. No side panels, no split diff views, no external tools.
Status: pre-alpha. The commands below work but have seen little use yet.
:show-diff-change — shows only the change under the cursor (one hunk,
however many lines) as a colored diff in a hover-style popup. Deleted lines
are marked with -, added ones with +. C-d / C-u scroll, Esc closes,
and any other key closes the popup and then does what it normally does, so
]g takes you straight to the next change. Pairs with the built-in
:reset-diff-change.:open-diff-base — opens the file as it is in HEAD in a scratch buffer
in the same window, with the same syntax highlighting and the old lines of the
change under the cursor already selected, so you can move around and yank
from it. Run it again (or switch to another buffer) to go back; the buffer
closes itself when you leave it (gp, ga, the buffer picker, ...). Edits
made there are thrown away. Helix counts the buffer as modified, so close it
by hand with :bc! rather than :bc.helix-git binds no keys. A suggestion for your init.scm, next to Helix's
space k hover:
(require (only-in "helix/keymaps.scm" keymap))
(keymap (global)
(normal (space (m ":show-diff-change")
(M ":open-diff-base"))))
HEAD. When that happens to the file
you are looking at, the commands say so in the status line; :reload brings
the gutter up to date.HEAD version and diff are
reused while neither the buffer nor HEAD changes, so repeating a command is
free. HEAD versions are cached under your temp directory in helix-git/.HEAD,
including unsaved buffer changes), so what you see matches the markers.steel-event-system branch of
mattwparas/helix) and forgegit on your PATHInstall with forge:
forge pkg install --git https://github.com/hardhus/helix-git.git
Then load it from your init.scm:
(require "helix-git/helix-git.scm")
For development, require your local checkout instead:
(require "/path/to/helix-git/helix-git.scm")
The parts that do not need the editor have tests that run with plain steel
from the repository root:
steel tests/hunks-test.scm
steel tests/repo-test.scm
steel tests/git-test.scm
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.