lf: highlight line in find_word
This commit is contained in:
parent
6e2e0d6d89
commit
ee67adaf8e
|
@ -141,26 +141,33 @@ cmd fzf ${{
|
||||||
}}
|
}}
|
||||||
|
|
||||||
cmd find_word ${{
|
cmd find_word ${{
|
||||||
set +ue
|
set +ue
|
||||||
rg_cmd="rg -uu --column --line-number --no-heading --color=always --smart-case --follow"
|
|
||||||
res="$(
|
BAT="bat --style=plain --color=always --italic-text=always --pager=never --tabs=4 --theme=base16"
|
||||||
fzf --disabled --ansi --exact --layout=reverse --header 'Searching file contents' --delimiter=: \
|
|
||||||
--bind="start:reload([ -n {q} ] && $rg_cmd -- {q} || true)" \
|
rg_cmd="rg -uu --column --line-number --no-heading --color=always --smart-case --follow"
|
||||||
--bind="change:reload([ -n {q} ] && $rg_cmd -- {q} || true)" \
|
|
||||||
--preview-window="right,50%" \
|
res="$(
|
||||||
--preview='~/.config/lf/preview {1} "$FZF_PREVIEW_COLUMNS" "$FZF_PREVIEW_LINES" "$FZF_PREVIEW_LEFT" "$FZF_PREVIEW_TOP"'
|
fzf --disabled --ansi --exact --layout=reverse --header 'Searching file contents' --delimiter=: \
|
||||||
)"
|
--bind="start:reload([ -n {q} ] && $rg_cmd -- {q} || true)" \
|
||||||
file="$(realpath "$(echo "$res" | cut -d':' -f1 | sed 's/\\/\\\\/g;s/"/\\"/g')" 2>/dev/null)"
|
--bind="change:reload([ -n {q} ] && $rg_cmd -- {q} || true)" \
|
||||||
row="$(echo "$res" | cut -d':' -f2)"
|
--preview-window="right,50%,+{2}/2" \
|
||||||
column="$(echo "$res" | cut -d':' -f3)"
|
--preview="$BAT"' --highlight-line {2} {1} "$FZF_PREVIEW_COLUMNS" "$FZF_PREVIEW_LINES" "$FZF_PREVIEW_LEFT" "$FZF_PREVIEW_TOP"'
|
||||||
if [ -n "$res" ]; then
|
)"
|
||||||
if [ "$EDITOR" = "nvim" ] || [ "$EDITOR" = "vim" ]; then
|
|
||||||
lf -remote "send $id \$$EDITOR +'call cursor($row, $column)' -- '$file'"
|
file="$(realpath "$(echo "$res" | cut -d':' -f1 | sed 's/\\/\\\\/g;s/"/\\"/g')" 2>/dev/null)"
|
||||||
else
|
row="$(echo "$res" | cut -d':' -f2)"
|
||||||
lf -remote "send $id \$$EDITOR '$file'"
|
column="$(echo "$res" | cut -d':' -f3)"
|
||||||
|
|
||||||
|
if [ -n "$res" ]; then
|
||||||
|
if [ "$EDITOR" = "nvim" ] || [ "$EDITOR" = "vim" ]; then
|
||||||
|
lf -remote "send $id \$$EDITOR +'call cursor($row, $column)' -- '$file'"
|
||||||
|
else
|
||||||
|
lf -remote "send $id \$$EDITOR '$file'"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
return 0
|
return 0
|
||||||
}}
|
}}
|
||||||
|
|
||||||
cmd find_project ${{
|
cmd find_project ${{
|
||||||
|
|
Loading…
Reference in New Issue