-
Notifications
You must be signed in to change notification settings - Fork 1
/
lfrc
34 lines (30 loc) · 1.38 KB
/
lfrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
set icons
cmd fzf_jump ${{
res="$(find . -type f -o -type d | fzf --reverse --header="Jump to location")"
if [ -n "$res" ]; then
if [ -d "$res" ]; then
cmd="cd"
else
cmd="select"
fi
res="$(printf '%s' "$res" | sed 's/\\/\\\\/g;s/"/\\"/g')"
lf -remote "send $id $cmd \"$res\""
fi
}}
map ff :fzf_jump
cmd fzf_search ${{
cmd="rg --column --line-number --no-heading --color=always --smart-case"
fzf --ansi --disabled --layout=reverse --header="Search in files" --delimiter=: \
--bind="start:reload([ -n {q} ] && $cmd -- {q} || true)" \
--bind="change:reload([ -n {q} ] && $cmd -- {q} || true)" \
--bind='enter:become(lf -remote "send $id select \"$(printf "%s" {1} | sed '\''s/\\/\\\\/g;s/"/\\"/g'\'')\"")' \
--preview='cat -- {1}' # Use your favorite previewer here (bat, source-highlight, etc.), for example:
#--preview-window='+{2}-/2' \
#--preview='bat --color=always --highlight-line={2} -- {1}'
# Alternatively you can even use the same previewer you've configured for lf
#--preview='~/.config/lf/cleaner; ~/.config/lf/previewer {1} "$FZF_PREVIEW_COLUMNS" "$FZF_PREVIEW_LINES" "$FZF_PREVIEW_LEFT" "$FZF_PREVIEW_TOP"'
}}
map fg :fzf_search
cmd on-select &{{
lf -remote "send $id set statfmt \"$(eza -ld --color=always "$f" | sed 's/\\/\\\\/g;s/"/\\"/g')\""
}}