diff --git a/README.md b/README.md index c238ad34..030c2767 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ A plugin that integrates [fzf](https://github.com/junegunn/fzf) into your [fish] ![git status select](/images/git_status_select.png) -> Search the current repository's **git log** - `Ctrl+Alt+l` (l for log, Alt to prevent overriding clear screen) +> Search and preview the current repository's **git log** - `Ctrl+Alt+l` (l for log, Alt to prevent overriding clear screen) ![git log search](/images/git_log_search.png) diff --git a/functions/__fzf_search_git_log.fish b/functions/__fzf_search_git_log.fish index d2807770..ffc72864 100644 --- a/functions/__fzf_search_git_log.fish +++ b/functions/__fzf_search_git_log.fish @@ -6,8 +6,8 @@ function __fzf_search_git_log --description "Search the git log of the current g set selected_log_line ( # see documentation for git format placeholders at https://git-scm.com/docs/git-log#Documentation/git-log.txt-emnem # %h gives you the abbreviated commit hash, which is useful for saving screen space, but we will have to expand it later below - git log --color=always --format=format:'%C(bold blue)%h%C(reset) - %C(cyan)%aD%C(reset) %C(yellow)%d%C(reset) %C(normal)%s%C(reset) %C(dim normal)[%an]%C(reset)' | \ - fzf --ansi --tiebreak=index + git log --color=always --format=format:'%C(bold blue)%h%C(reset) - %C(cyan)%as%C(reset) %C(yellow)%d%C(reset) %C(normal)%s%C(reset) %C(dim normal)[%an]%C(reset)' | \ + fzf --ansi --tiebreak=index --preview='git show --color=always (string split --max 1 " " {})[1]' ) if test $status -eq 0 set abbreviated_commit_hash (string split --max 1 " " $selected_log_line)[1] diff --git a/images/git_log_search.png b/images/git_log_search.png index b824f5d6..cee24a22 100644 Binary files a/images/git_log_search.png and b/images/git_log_search.png differ