NGDF/dots/lf/functions

50 lines
1.2 KiB
Plaintext

# Defines opening systems, both :open and :rifle
cmd open ${{
rifle $fx
}}
cmd rifle ${{
rifle -l $f
read -p "Select runner: " runner
rifle -p $runner $f
}}
# Sets prompt
cmd on-cd &{{
printf "\033]0;lf:$(pwd | sed "s|$HOME|~|")\007" > /dev/tty
}}
# Create playlist file out of list of selected items.
cmd playlist ${{
for x in "${fx}"
do
echo -e "$x\n" >> /tmp/playlist.txt
done
}}
# Create playlist file out of list of selected items.
cmd clipfile ${{
wl-copy < "${f}"
}}
# Use FD to find directory and then cd to said directory in current lf instance.
cmd fdcd ${{
full=$(sk -c "fd -t f -t d --search-path ~" --layout=reverse --header="Seach for the files or directory you wish to be in." --color="header:5" --preview="~/.config/lf/miniscope.sh {+}")
# Check if file and check dirname if so. If not, treat as dir.
if [ -f "${full}" ]; then
dir=$(dirname "${full}")
else
dir=$full
fi
lf -remote "send $id cd \"${dir}\""
# Check if file, and if so select it.
if [ -f "${full}" ]
then
basename=$(basename "${full}")
lf -remote "send $id select \"${basename}\""
fi
}}