Skip to content

Instantly share code, notes, and snippets.

View gloaysa's full-sized avatar
🏠
Working from home

Guillermo Loaysa gloaysa

🏠
Working from home
View GitHub Profile
#!/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"