Last active
October 18, 2023 23:58
-
-
Save trinitronx/f961d3797bb83d0abffea9031e09ada7 to your computer and use it in GitHub Desktop.
My version of git-fzf: gls (plus helpful aliases & snippets from my .gitconfig)
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
[color] | |
branch = auto | |
diff = auto | |
interactive = auto | |
status = auto | |
ui = auto | |
[core] | |
pager = less -FXRS -x2 | |
[alias] | |
st = status | |
di = diff | |
co = checkout | |
ci = commit | |
br = branch | |
sta = stash | |
llog = log --date=local | |
flog = log --pretty=fuller --decorate | |
lg = log --graph --abbrev-commit --date=relative --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative | |
lol = log --graph --decorate --oneline --abbrev-commit | |
lola = log --graph --decorate --oneline --all --abbrev-commit | |
logg = log --graph --decorate --all | |
blog = log origin/master... --left-right | |
ds = diff --staged | |
ls = ls-files | |
l = log --pretty=oneline --abbrev-commit | |
fixup = commit --fixup | |
squash = commit --squash | |
unstage = reset HEAD | |
rum = rebase master@{u} | |
lgs = log --graph --pretty=format:'%C(auto)%h - %Cgreen(sig: %G?)%Creset -%d %s %Cgreen(%cr) %C(bold blue)<%an>%Creset%n%>|(10)%C(green)\\%Creset%n%>|(11)%C(green)gpg: Key ID %GK%Creset%n%C(green)%>|(250)%GG%Creset' --abbrev-commit | |
oldest-ancestor = !bash -c \"diff -u <(git rev-list --first-parent \\\"${1:-master}\\\") <(git rev-list --first-parent \\\"${2:-HEAD}\\\") | sed -ne 's/^ //p' | head -1\" | |
unstage-all = reset HEAD -- | |
changes=diff --name-status -r | |
svn-switch = config svn-remote.svn.url | |
sw = config svn-remote.svn.url | |
[merge] | |
guitool = meld | |
# If you have delta installed... uncomment to use it for diff output w/syntax-hilighting | |
#[interactive] | |
# diffFilter = delta --color-only --line-numbers | |
[delta] | |
features = Matcha-Dark-Theme zebra-dark | |
[delta "Matcha-Dark-Theme"] | |
syntax-theme = Matcha-Dark | |
minus-style = syntax "#641f39" | |
minus-emph-style = syntax bold "#902c29" | |
plus-emph-style = "#9fca56" bold "#295738" | |
plus-style = syntax "#123730" | |
keep-plus-minus-markers = true |
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
# Source: https://gist.github.com/junegunn/f4fca918e937e6bf5bad?permalink_comment_id=3356674#gistcomment-3356674 | |
alias glNoGraph='git log --color=always --format="%C(auto)%h%d %s %C(brightblack)%C(bold)%cr% C(auto)%an %G?" "$@"' | |
_gitLogLineToHash="echo {} | grep -o '[a-f0-9]\{7\}' | head -1" | |
_viewGitLogLine="$_gitLogLineToHash | xargs -I % sh -c 'git show --color=always --show-signature % | delta'" | |
_viewGitLogLineUnfancy="$_gitLogLineToHash | xargs -I % sh -c 'git show %'" | |
# ANSI Colors | |
c_reset='\033[0m' | |
c_black='\033[0;30m' | |
c_red='\033[0;31m' | |
c_green='\033[0;32m' | |
c_yellow='\033[0;33m' | |
c_blue='\033[0;34m' | |
c_magenta='\033[0;35m' | |
c_cyan='\033[0;36m' | |
c_white='\033[0;37m' | |
short_help_text='enter to view, alt-y to copy hash, alt-v to open in vim' | |
read -r -d '' long_help_text <<EOSHORT | |
Actions: | |
enter = show commit | |
alt-y = copy hash | |
alt-v = open in vim | |
? = show long help | |
ctrl-alt-l = clear / refresh screen & hide long help | |
Navigation: | |
ctrl-/ = Toggle Preview: 70%, 99%, hidden, default | |
ctrl-j, down = select next commit | |
ctrl-k, up = select prev commit | |
ctrl-h = goto latest commit | |
ctrl-l = goto first commit | |
ctrl-b, pageup = page up commits | |
ctrl-f, pagedown = page down commits | |
alt-up, alt-b = scroll preview page up | |
alt-down, alt-f = scroll preview page down | |
alt-j = scroll preview half page down | |
alt-k = scroll preview half page up | |
alt-h, home = goto preview top | |
alt-l, end = goto preview end | |
EOSHORT | |
# Transform %G? GPG output into colored JetbrainsMono Nerd Font Icons | |
# View current mappings via: | |
# echo -e 'G= G\nU= U\nB= B\nY= Y\nX= X\nR= R\nN= N\nE= E' | _sigVerifyIconFilter | |
# For letter meanings: git help log | grep -A3 -E '%G\?' | |
alias _sigVerifyIconFilter="sed -e \"s/G$/$(echo -e $c_green)✔ $(echo -e $c_reset)/; s/U$/$(echo -e $c_cyan)✔ ❔$(echo -e $c_reset)/; s/B$/$(echo -e $c_red)✘ $(echo -e $c_reset)/; s/Y$/$(echo -e $c_green)✔$(echo -e ${c_reset}${c_yellow}) $(echo -e $c_reset)/; s/X$/$(echo -e $c_green)✔$(echo -e ${c_reset}${c_yellow}) $(echo -e $c_reset)/; s/R$/$(echo -e $c_green)✔$(echo -e ${c_reset}${c_magenta}) $(echo -e $c_reset)/; s/N$/$(echo -e $c_cyan)$(echo -e $c_reset)/; s/E$/$(echo -e $c_blue) ❔$(echo -e $c_reset)/;\"" | |
#_sigVerifyIconFilter="sed -e \"s/N$//;\"" | |
gls() { | |
glNoGraph | _sigVerifyIconFilter | \ | |
fzf --no-sort --reverse --tiebreak=index --no-multi \ | |
--ansi --preview="$_viewGitLogLine" \ | |
--header "enter to view, alt-y to copy hash, alt-v to open in vim" \ | |
--bind "enter:execute:$_viewGitLogLine | less -R" \ | |
--bind "alt-v:execute:$_viewGitLogLineUnfancy | vim -" \ | |
--bind "alt-y:execute:$_gitLogLineToHash | wl-copy" \ | |
--prompt ' > ' \ | |
--bind 'ctrl-/:+change-preview-window(70%|99%|hidden|)' \ | |
--bind 'ctrl-/:+refresh-preview' \ | |
--bind 'alt-up:preview-page-up' \ | |
--bind 'alt-down:preview-page-down' \ | |
--bind 'alt-b:preview-page-up' \ | |
--bind 'alt-f:preview-page-down' \ | |
--bind 'alt-j:preview-half-page-down' \ | |
--bind 'alt-k:preview-half-page-up' \ | |
--bind 'ctrl-b:page-up' \ | |
--bind 'ctrl-f:page-down' \ | |
--bind 'home:preview-top' \ | |
--bind 'end:preview-bottom' \ | |
--bind 'ctrl-h:first' \ | |
--bind 'ctrl-l:last' \ | |
--bind 'alt-h:preview-top' \ | |
--bind 'alt-l:preview-bottom' \ | |
--bind "ctrl-alt-l:clear-screen+change-header($short_help_text)" \ | |
--bind "?:change-header($long_help_text)" \ | |
--bind 'load:+change-prompt: > ' \ | |
--color 'fg:#999999,fg+:#ccd7d4,bg:#1b2224,gutter:#1b2224,preview-bg:#141a1b,border:#707a7a,scrollbar:#2eb398,pointer:#ac3562,hl:#ac74f9,query:#ccd7d4,prompt:#45ff82,marker:#ac3562,preview-label:#2eb398,preview-border:#2eb398,hl+:#b07aff,header:#45ff82,separator:#697521' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment