This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Utility for Helix: open the patch for the commit that last touched the current line. | |
# If the line isn’t committed yet, it shows the working-tree diff for THIS file only. | |
# The script writes the diff to /tmp and prints the absolute path to stdout | |
# Adjust `context` to see more/fewer unchanged lines around the change (default: 3). | |
# | |
# usage: git-file_pretty.sh <file> <line> [context_lines] | |
# Helix mapping example: | |
# B = ':open %sh{ ~/.config/helix/utils/git-blame-commit.sh "%{buffer_name}" %{cursor_line} 3 }' | |
file="$1" |