add fzy files to lf
This commit is contained in:
parent
9fe0657309
commit
5041acdf5c
|
@ -13,3 +13,31 @@ 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
|
||||
|
|
Loading…
Reference in New Issue