-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Search git status] preview changed files (#237)
Show a preview of the unstaged and staged changes of the hovered-over file. This will make it easier to identify which files to select and perhaps offer a faster-to-navigate alternative to git diff.
- Loading branch information
Showing
4 changed files
with
22 additions
and
1 deletion.
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
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,19 @@ | ||
# helper for _fzf_search_git_status | ||
# arg should be a line from git status --short, something like... | ||
# MM functions/_fzf_preview_changed_file.fish | ||
function _fzf_preview_changed_file | ||
set -l path (string split ' ' $argv)[-1] | ||
if string match -r '^\?\?' $argv --quiet | ||
echo -e (set_color --underline)=== Untracked ===\n | ||
_fzf_preview_file $path | ||
else | ||
if string match -r '\S\s\S' $argv --quiet | ||
echo -e (set_color --underline red)=== Unstaged ===\n | ||
git diff --color=always -- $path | ||
end | ||
if string match -r '^\S' $argv --quiet | ||
echo -e (set_color --underline green)=== Staged ===\n | ||
git diff --color=always --staged -- $path | ||
end | ||
end | ||
end |
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
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