23 lines
658 B
Bash
23 lines
658 B
Bash
#!/bin/sh
|
|
|
|
clear
|
|
file="$(\
|
|
fzf --expect=' ' --select-1 --cycle --bind one:accept -q '^' -e -n1 --scheme=history --history="$XDG_DATA_HOME/lf/shortcut_history" --header='Searching Shortcuts' --preview='
|
|
file=$(cut -f2 <<< "{}")
|
|
if [ -f "$file" ] && [ -r "$file" ]; then
|
|
head -$LINES "$file"
|
|
elif [ -d "$file" ] && [ -r "$file" ]; then
|
|
ls -lhpANX --color=always --group-directories-first "$file"
|
|
fi
|
|
' <"$XDG_DATA_HOME/lf/dirs" |
|
|
cut -f2 |
|
|
tr -d '\n'
|
|
)"
|
|
|
|
if [ -d "$file" ]; then
|
|
lf -remote "send $id cd $file"
|
|
return
|
|
elif [ -f "$file" ]; then
|
|
lf -remote "send $id select $file"
|
|
fi
|