dotfiles/.config/lf/lfrc

44 lines
1.3 KiB
Plaintext

set icons true
set autoquit true
set mouse true
set number true
set relativenumber true
set cursorpreviewfmt ""
cmd q quit
map <backspace2> quit
map <c-e> half-up
map . set hidden!
map o $nvim -c "lua require(\"oil\").open(\"$PWD\")"
map - $nvim -c "lua require(\"oil\").open(\"$PWD\")"
map <enter> open
cmd jump ${{
FZY_CACHE=~/.cache/fzy_paths
if [ -f $FZY_CACHE ]; then
# Check if cache is older than 1 day
if [ $(($(date +%s) - $(date -r $FZY_CACHE +%s))) -gt 86400 ]; then
rm $FZY_CACHE
fi
fi
if [ ! -f $FZY_CACHE ]; then
PATHS="$(/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME ls-files | xargs -n 1 dirname | uniq | grep -v '^\.$' | parallel echo ~/{})"
search_dirs=(~/Workspace/ \
/home/server/Storage/Thomas/ \
)
for i in $search_dirs ; do
if [ -d $i ]; then
PATHS="$PATHS\n$i"
PATHS="$PATHS\n$(ssh mallorea fdfind . $i -t d -d 8)"
fi
done
echo -e $PATHS > $FZY_CACHE
fi
res="$(cat $FZY_CACHE | fzy -l 20)"
res="$(printf '%s' "$res" | sed 's/\\/\\\\/g;s/"/\\"/g')"
lf -remote "send $id cd \"$res\""
}}
map <c-t> :jump