diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 6cb8f60c..c3ea070d 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -13,8 +13,7 @@ set promptfmt "\033[34;1m%u\033[36m@\033[34m%h \033[35m[\033[0;1m%d\033[35m]\033 set opener=opener cmd pushedit %{{ - echo "Open: " - files=$(read x; echo $x) + echo "Open: " && read files if sh -c '[ -n "$VIM" ]'; then lf -remote "send $id vimopen $files" else @@ -56,8 +55,16 @@ cmd trash &{{ lf -remote "send load" }} -cmd lazygit &{{ - lf -remote "send $id \$cd "$(dirname "$(realpath "$f")")" && lazygit" +cmd lazygit %{{ + dir=$(dirname "$(realpath "${f:-_}")"}) + if ! git --noglob-pathspecs -C $dir status >/dev/null 2>&1; then + echo "Initialize git repo in '${dir}' [Y/n]:" && read yn && + case $yn in + "" | [Yy]*) git -C ${dir} init >/dev/null 2>&1; break ;; + [Nn]*) ;; + esac + fi + lf -remote "send $id \$cd '$dir' && lazygit" }} # y (select for copy) and P to paste soft-link