dotfiles/.config/lf/lfrc

55 lines
1.6 KiB
Plaintext
Raw Normal View History

2021-04-27 23:25:21 +03:00
set previewer ~/.config/lf/pv.sh
map i $~/.config/lf/pv.sh $f | less -R
2021-08-28 20:15:49 +03:00
# Trash
cmd trash %trash-put "$fx"
# Search with fzf
2022-09-10 16:13:56 +03:00
# map f $vi $(fzf)
# If you want to jump to a file or directory in lf using fuzzy matching, you can utilize fzf for this purpose:
cmd fzf_jump ${{
res="$(fd . | fzf --reverse --header='Jump to location' | sed 's/\\/\\\\/g;s/"/\\"/g')"
if [ -d "$res" ] ; then
cmd="cd"
elif [ -f "$res" ] ; then
cmd="select"
else
exit 0
fi
lf -remote "send $id $cmd \"$res\""
}}
map f :fzf_jump
# Combining fzf with ripgrep, you can interactively search in the contents of files under the current directory and select a file from the results:
cmd fzf_search ${{
res="$( \
RG_PREFIX="rg --column --line-number --no-heading --color=always \
--smart-case "
FZF_DEFAULT_COMMAND="$RG_PREFIX ''" \
fzf --bind "change:reload:$RG_PREFIX {q} || true" \
--ansi --layout=reverse --header 'Search in files' \
| cut -d':' -f1
)"
[ ! -z "$res" ] && lf -remote "send $id select \"$res\""
}}
map gs :fzf_search
2021-08-28 20:15:49 +03:00
# Recreate open-with with lf
cmd open-with %"$@" "$fx"
map ` push :open-with<space>
# Show current directory in window title
cmd on-cd &{{
# '&' commands run silently in background (which is what we want here),
# but are not connected to stdout.
# To make sure our escape sequence still reaches stdout we pipe it to /dev/tty
printf "\033]0; $PWD\007" > /dev/tty
}}
map r reload
# Drag and drop
map <c-d> %dragon --all --and-exit "$fx"
map <c-c> &wl-copy < "$fx"