From 1896207312a9a5c3c6a92bcccf58dc2c2b5c7f45 Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Thu, 16 Dec 2021 19:27:09 +0530 Subject: [PATCH] fish: functions/fbr: Drop use of delta and xclip We do not use delta anymore (neovim for everything) and instead of xclip we need wl-copy in Wayland. While at it, also add support for scrolling the preview. --- fish/.config/fish/functions/fbr.fish | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fish/.config/fish/functions/fbr.fish b/fish/.config/fish/functions/fbr.fish index fd5c81a..f31d117 100644 --- a/fish/.config/fish/functions/fbr.fish +++ b/fish/.config/fish/functions/fbr.fish @@ -1,7 +1,8 @@ function fbr --description 'Git browse commits' set -l log_line_to_hash "echo {} | grep -o '[a-f0-9]\{7\}' | head -1" - set -l view_commit "$log_line_to_hash | xargs -I % sh -c 'git show --color=always % | delta | less -R'" - set -l copy_commit_hash "$log_line_to_hash | xclip" + set -l view_commit "$log_line_to_hash | xargs -I % sh -c 'git show --color=always % | bat -ldiff'" + set -l view_commit_nvim "$log_line_to_hash | xargs -I % sh -c 'git show %'" + set -l copy_commit_hash "$log_line_to_hash | wl-copy" set -l git_checkout "$log_line_to_hash | xargs -I % sh -c 'git checkout %'" set -l open_cmd "open" @@ -15,8 +16,9 @@ function fbr --description 'Git browse commits' fzf --exact --no-sort --reverse --tiebreak=index --no-multi --ansi \ --preview="$view_commit" \ --header="ENTER to view, CTRL-Y to copy hash, CTRL-O to open on GitHub, CTRL-X to checkout, CTRL-C to exit" \ - --bind "enter:execute:$view_commit" \ + --bind "enter:execute:$view_commit_nvim | nvim -R -" \ --bind "ctrl-y:execute:$copy_commit_hash" \ --bind "ctrl-x:execute:$git_checkout" \ - --bind "ctrl-o:execute:$github_open" + --bind "ctrl-o:execute:$github_open" \ + --bind "ctrl-d:half-page-down,ctrl-u:half-page-up,ctrl-n:preview-down,ctrl-p:preview-up,ctrl-f:preview-page-down,ctrl-b:preview-page-up" end