mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-21 19:11:30 +01:00
zsh: improve fgitlog, make it a function
This commit is contained in:
parent
8e760f3e3e
commit
cce075e29c
|
@ -83,7 +83,6 @@ alias venv='source .venv/bin/activate'
|
|||
|
||||
# Run fzf with file preview
|
||||
alias pf="fzf --preview='BAT_STYLE='header,changes' bat --color=always {}' --bind shift-up:preview-page-up,shift-down:preview-page-down"
|
||||
alias fgitlog="git log --oneline | fzf --multi --preview 'git -p show --color=always {+1}'"
|
||||
|
||||
# dvc
|
||||
alias dst='dvc status'
|
||||
|
|
22
functions.sh
22
functions.sh
|
@ -300,6 +300,28 @@ function retry() {
|
|||
# Creats a gitignore for the given argument (e.g. python, cpp, etc)
|
||||
function gi() { curl -sL https://www.toptal.com/developers/gitignore/api/$@; }
|
||||
|
||||
# Runs git log with fzf with preview
|
||||
compdef _git fgitlog=git-log
|
||||
function fgitlog() {
|
||||
git log --oneline $@ | fzf --multi --preview 'git -p show --color=always {+1}' --preview-window=right,60%
|
||||
}
|
||||
|
||||
compdef _git fgitlog=git-log
|
||||
git-commit-show() {
|
||||
git log --graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" |
|
||||
fzf --ansi --no-sort --reverse --tiebreak=index --preview \
|
||||
'f() {
|
||||
set -- $(echo -- "$@" | grep -o "[a-f0-9]\{7\}")
|
||||
[ $# -eq 0 ] || git show --color=always $1
|
||||
}
|
||||
f {}' \
|
||||
--bind "j:down,k:up,alt-j:preview-down,alt-k:preview-up,ctrl-f:preview-page-down,ctrl-b:preview-page-up,q:abort,ctrl-m:execute:
|
||||
(grep -o '[a-f0-9]\{7\}' | head -1 |
|
||||
xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF'
|
||||
{} FZF-EOF" \
|
||||
--preview-window=right:60%
|
||||
}
|
||||
|
||||
# dotfiles user functions
|
||||
if [[ -f $HOME/.dotfiles_functions ]]; then
|
||||
source "$HOME/.dotfiles_functions"
|
||||
|
|
Loading…
Reference in New Issue
Block a user