-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(helix): add tmux git-blame workaround
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Select Original pane | ||
ORIGINAL_PANE=$(tmux select-pane -U) | ||
|
||
# Capture the output of the original pane | ||
PANE_OUTPUT=$(tmux capture-pane -p -t $ORIGINAL_PANE) | ||
|
||
# Back to the bottom pane | ||
tmux select-pane -D | ||
|
||
# Extract file and line information | ||
RES=$(echo "$PANE_OUTPUT" | rg -e "(?:NOR|INS|SEL)\s+(\S*)\s[^│]* (\d+):*.*" -o --replace '$1 $2') | ||
FILE=$(echo $RES | choose 0) | ||
LINE=$(echo $RES | choose 1) | ||
|
||
# Run git blame and fzf commands | ||
git blame -L $LINE,+100 $FILE --color-by-age --color-lines | | ||
fzf --ansi \ | ||
--border \ | ||
--delimiter ':' \ | ||
--height '100%' \ | ||
--multi \ | ||
--print-query --exit-0 \ | ||
--scrollbar '▍' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ hidden = false | |
|
||
[keys.normal.g] | ||
q = ":reflow" | ||
B = ":pipe-to tmux split-window -v helix-git-blame" |