diff --git a/dotfiles/lf/lfrc b/dotfiles/lf/lfrc index 15b8558..a0ca2df 100644 --- a/dotfiles/lf/lfrc +++ b/dotfiles/lf/lfrc @@ -1,23 +1,47 @@ cmap cmd-menu-complete cmap cmd-menu-complete-back -## https://github.com/gokcehan/lf/wiki/Integrations#eza -#cmd on-select &{{ -# lf -remote "send $id set statfmt \"$(eza -ld --color=always "$f" | sed 's/\\/\\\\/g;s/"/\\"/g')\"" -#}} -# -#cmd git_branch ${{ -# git branch | fzf | xargs git checkout -# pwd_shell="$(pwd | sed 's/\\/\\\\/g;s/"/\\"/g')" -# lf -remote "send $id updir; cd \"$pwd_shell\"" -#}} -#map gb :git_branch -#map gp $clear; git pull --rebase || true; echo "press ENTER"; read ENTER -#map gs $clear; git status; echo "press ENTER"; read ENTER -#map gl $clear; git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -# -#cmd on-cd &{{ -# fmt="$(STARSHIP_SHELL= starship prompt | sed 's/\\/\\\\/g;s/"/\\"/g')" -# lf -remote "send $id set promptfmt \"$fmt\"" -#}} +cmd fzf_search ${{ + cmd="rg --column --line-number --no-heading --color=always --smart-case" + fzf --ansi --disabled --layout=reverse --header="Search in files" --delimiter=: \ + --bind="start:reload([ -n {q} ] && $cmd -- {q} || true)" \ + --bind="change:reload([ -n {q} ] && $cmd -- {q} || true)" \ + --bind='enter:become(lf -remote "send $id select \"$(printf "%s" {1} | sed '\''s/\\/\\\\/g;s/"/\\"/g'\'')\"")' \ + --preview-window='+{2}-/2' \ + --preview='bat --color=always --highlight-line={2} -- {1}' + # --preview='cat -- {1}' # Use your favorite previewer here (bat, source-highlight, etc.), for example: + # --preview-window='+{2}-/2' \ + # --preview='bat --color=always --highlight-line={2} -- {1}' + # Alternatively you can even use the same previewer you've configured for lf + #--preview='~/.config/lf/cleaner; ~/.config/lf/previewer {1} "$FZF_PREVIEW_COLUMNS" "$FZF_PREVIEW_LINES" "$FZF_PREVIEW_LEFT" "$FZF_PREVIEW_TOP"')" +}} +map gs :fzf_search +# https://github.com/gokcehan/lf/wiki/Integrations#eza +cmd on-select &{{ + lf -remote "send $id set statfmt \"$(eza -ld --color=always "$f" | sed 's/\\/\\\\/g;s/"/\\"/g')\"" +}} + +cmd git_branch ${{ + git branch | fzf | xargs git checkout + pwd_shell="$(pwd | sed 's/\\/\\\\/g;s/"/\\"/g')" + lf -remote "send $id updir; cd \"$pwd_shell\"" +}} +map gb :git_branch +map gp $clear; git pull --rebase || true; echo "press ENTER"; read ENTER +map gs $clear; git status; echo "press ENTER"; read ENTER +map gl $clear; git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit + +cmd on-cd &{{ + fmt="$(STARSHIP_SHELL= starship prompt | sed 's/\\/\\\\/g;s/"/\\"/g')" + lf -remote "send $id set promptfmt \"$fmt\"" +}} + +set sixel true +set previewer ~/.config/lf/previewer + +# https://github.com/gokcehan/lf/wiki/Previews#with-sixel +# set previewer ctpv +# set cleaner ctpvclear +# &ctpv -s $id +# &ctpvquit $id