diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 5598a307..1b390fab 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -148,9 +148,22 @@ cmd bulkrename ${{ lf -remote "send $id unselect" }} +cmd shortcutjump ${{ + set -f + clear; tput cup $(($(tput lines)/3)) + tmp="$(mktemp)" && trap 'rm "$tmp"' EXIT || exit + sed 's/\s*#.*//; /^$/d' "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs" > "$tmp" + choice=$(cat "$tmp" | fzf --layout=reverse --height 40% --listen --no-ignore-case --tiebreak=begin,chunk -n1 \ + --bind result:transform:"grep -q '^{q}\s' \"$tmp\" && [ \$(grep '^{q}\S*\s' \"$tmp\" | wc -l) -eq 1 ] && echo accept" | \ + sed 's/\S\+\s\+//') + [ -z "$choice" ] && exit + path=$(eval printf '%s' \"$choice\") + lf -remote "send $id cd $path" +}} + # Bindings map $lf -remote "send $id select \"$(fzf)\"" -map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)" +map J shortcutjump map H cd ~ map g top map D delete