dotfiles/.config/lf/lfrc

44 lines
1.3 KiB
Plaintext
Raw Normal View History

2024-04-21 14:22:08 +02:00
set icons true
set autoquit true
set mouse true
set number true
set relativenumber true
set cursorpreviewfmt ""
2024-04-21 21:01:06 +02:00
cmd q quit
map <backspace2> quit
map <c-e> half-up
map . set hidden!
map o $nvim -c "lua require(\"oil\").open(\"$PWD\")"
2024-04-21 21:10:45 +02:00
map - $nvim -c "lua require(\"oil\").open(\"$PWD\")"
2024-04-21 21:01:06 +02:00
map <enter> open
2024-04-21 21:26:38 +02:00
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