From c8d8c4674c66cbd974b3a7ae33becdd13ee8c501 Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Mon, 15 Jul 2024 17:37:48 +0200 Subject: [PATCH] lf: performance and usability improvements in fzf --- .config/lf/lfrc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.config/lf/lfrc b/.config/lf/lfrc index b4fac2479..fefe64a0a 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -118,6 +118,7 @@ cmd fzf ${{ clear file="$(eval "$input" | fzf \ + --exact \ --query "$query" \ --delimiter "$delimiter" \ --nth="$field" \ @@ -151,15 +152,21 @@ for cmd in bat batcat head; do done res="$( FZF_DEFAULT_COMMAND="$RG_PREFIX ." SEDPATTERN='s/\\/\\\\/g;s/"/\\"/g' SHELL="sh" \ - fzf --bind "change:reload:${RG_PREFIX} {q} || true" \ - --preview-window="right,50%" --preview=" + fzf \ + --ansi \ + --exact \ + --bind "change:reload:${RG_PREFIX} {q} || true" \ + --preview-window="right,50%" \ + --preview=" file=\$(realpath \"\$(echo {} | cut -d: -f1 | sed \"\${SEDPATTERN}\")\" 2>/dev/null) case '$cmd' in head) head -n 300 \"\$file\" ;; bat*) '$cmd' --color=always --italic-text=always --style=plain --pager=never \ --tabs=4 --theme=base16 --line-range :300 \"\$file\" ;; esac - " --ansi --layout=reverse --header 'Searching file contents' + " \ + --layout=reverse \ + --header 'Searching file contents' )" file="$(realpath "$(echo "$res" | cut -d':' -f1 | sed 's/\\/\\\\/g;s/"/\\"/g')" 2>/dev/null)" row="$(echo "$res" | cut -d':' -f2)" @@ -245,7 +252,7 @@ map shell-wait map find_project map t fzf 'Tags' 'cat $XDG_DATA_HOME/lf/tags 2>/dev/null' ':' '1' '1' '50%' map m fzf 'Marks' 'cat $XDG_DATA_HOME/lf/marks 2>/dev/null' ':' '1' '2' '85%' '^' -map f fzf 'Files' 'find -L $PWD' ':' '1' '1' '50%' +map f fzf 'Files' 'fd -L --full-path $PWD' ':' '1' '1' '50%' map g find_word map "'" mark-load map '"' mark-remove