@@ -429,35 +429,19 @@ This will generate `gitlogue-demo.gif` with your session automatically recorded
429429
430430### fzf Integration
431431
432- Integrate gitlogue with [ fzf] ( https://github.com/junegunn/fzf ) for interactive commit selection:
433-
434- #### Basic Commit Browser
435-
436- ``` bash
437- # Select and view a commit with fzf
438- git log --oneline --color=always | \
439- fzf --ansi --preview ' gitlogue --commit {1}' \
440- --preview-window=right:70%
441- ```
442-
443- #### Interactive Commit Viewer
432+ Integrate gitlogue with [ fzf] ( https://github.com/junegunn/fzf ) for interactive commit selection.
444433
445434Add this function to your ` ~/.bashrc ` or ` ~/.zshrc ` :
446435
447436``` bash
448- # Browse commits with gitlogue preview
437+ # Browse commits and launch gitlogue on selection
449438glf () {
450- local commit
451- commit=$( git log --oneline --color=always " $@ " |
452- fzf --ansi \
453- --no-sort \
454- --preview ' git show --color=always {1}' \
455- --preview-window=right:60% \
456- --bind ' ctrl-g:execute(gitlogue --commit {1})' )
457-
458- if [ -n " $commit " ]; then
459- gitlogue --commit $( echo " $commit " | awk ' {print $1}' )
460- fi
439+ git log --oneline --color=always " $@ " | \
440+ fzf --ansi \
441+ --no-sort \
442+ --preview ' git show --stat --color=always {1}' \
443+ --preview-window=right:60% \
444+ --bind ' enter:become(gitlogue --commit {1})'
461445}
462446```
463447
471455glf --author=" Alice"
472456
473457# Browse commits in date range
474- glf --since =" 2 weeks ago"
458+ glf --after =" 2 weeks ago"
475459```
476460
477461#### Advanced fzf Menu
@@ -490,12 +474,17 @@ gitlogue-menu() {
490474 gitlogue
491475 ;;
492476 " Specific commit" )
493- local commit=$( git log --oneline | fzf --prompt=" Select commit> " | awk ' {print $1}' )
494- [ -n " $commit " ] && gitlogue --commit " $commit "
477+ git log --oneline | \
478+ fzf --prompt=" Select commit> " \
479+ --bind ' enter:become(gitlogue --commit {1})'
495480 ;;
496481 " By author" )
497482 local author=$( git log --format=' %an' | sort -u | fzf --prompt=" Select author> " )
498- [ -n " $author " ] && gitlogue
483+ [ -n " $author " ] && gitlogue --author " $author "
484+ ;;
485+ " By date range" )
486+ local after=$( echo -e " 1 day ago\n1 week ago\n2 weeks ago\n1 month ago" | fzf --prompt=" After> " )
487+ [ -n " $after " ] && gitlogue --after " $after "
499488 ;;
500489 " Theme selection" )
501490 local theme=$( gitlogue theme list | tail -n +2 | sed ' s/^ - //' | fzf --prompt=" Select theme> " )
0 commit comments