Add glog keybindings

This commit is contained in:
2020-08-29 23:23:12 +02:00
parent c951c69165
commit a74723fea6
3 changed files with 10 additions and 1 deletions

View File

@@ -335,6 +335,11 @@ glog() {
local date="--date=format:%F %T"
local colors="--color=always"
local binds=(
"ctrl-space:toggle-preview"
"ctrl-j:preview-down"
"ctrl-k:preview-up"
)
# Display a colorful ascii graph of the commits in the above format and pipe
# that into fzf.
@@ -346,7 +351,7 @@ glog() {
# on the commit hash.
commit="$(\
git log --pretty="$format" --graph "$date" $colors\
| fzf --ansi --reverse --preview="
| fzf --ansi --reverse --bind "${(j:,:)binds}" --preview="
out=\"\$(echo {} | sed -Ee \"$ansi_escape\" -e \"$commit_hash\")\"
if [ \"\$out\" ]; then
git show --pretty=fuller \"${date} %z\" $colors \"\$out\"

3
.gitmodules vendored
View File

@@ -46,3 +46,6 @@
[submodule ".config/zsh/plugins/zsh-syntax-highlighting"]
path = .config/zsh/plugins/zsh-syntax-highlighting
url = https://github.com/zsh-users/zsh-syntax-highlighting.git
[submodule ".config/vim/pack/plugins/opt/vim-polyglot"]
path = .config/vim/pack/plugins/opt/vim-polyglot
url = https://github.com/sheerun/vim-polyglot