mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-09 23:22:57 +00:00
feat: improved git fzf previews
This commit is contained in:
parent
5496127fc5
commit
84532e17d6
@ -4,19 +4,24 @@ function gittools
|
|||||||
|
|
||||||
function git-fuzzy-branch -a header
|
function git-fuzzy-branch -a header
|
||||||
set -l current (git rev-parse --abbrev-ref HEAD | tr -d '\n')
|
set -l current (git rev-parse --abbrev-ref HEAD | tr -d '\n')
|
||||||
set -l branch (git branch --format "%(refname:short)" | fzf --height 50% --header='On $current, $header' --preview-window right:70% --preview 'git log {} --color=always --pretty=oneline | cut -d" " -f2-')
|
set -l branch (git branch \
|
||||||
|
--format "%(refname:short)" \
|
||||||
|
| fzf \
|
||||||
|
--height 50% \
|
||||||
|
--header="On $current, $header" \
|
||||||
|
--preview-window right:70% \
|
||||||
|
--preview 'git log {} --color=always --pretty="format:%C(auto)%ar %h%d %s"' \
|
||||||
|
)
|
||||||
and echo $branch
|
and echo $branch
|
||||||
end
|
end
|
||||||
|
|
||||||
function git-commits
|
function git-commits
|
||||||
set commitline (git log --pretty=oneline | fzf --height 50% --preview 'git show --color=always (echo {} | cut -d" " -f1)')
|
set commitline (git log \
|
||||||
and set commit (echo $commitline | cut -d" " -f1)
|
--pretty="format:%C(auto)%ar %h%d %s" \
|
||||||
and git checkout $commit
|
| fzf \
|
||||||
end
|
--height 50% \
|
||||||
|
--preview 'git show --color=always (echo {} | cut -d" " -f4)' \
|
||||||
function git-branch
|
)
|
||||||
set branch (git branch --format "%(refname:short)" | fzf --height 50% --preview 'git log {} --pretty=oneline')
|
|
||||||
set commitline (git log --pretty=oneline | fzf --height 50% --preview 'git show --color=always (echo {} | cut -d" " -f1)')
|
|
||||||
and set commit (echo $commitline | cut -d" " -f1)
|
and set commit (echo $commitline | cut -d" " -f1)
|
||||||
and git checkout $commit
|
and git checkout $commit
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user