diff options
| author | Mohammad Reza Karimi <m.r.karimi.j@gmail.com> | 2026-01-29 11:40:03 -0500 |
|---|---|---|
| committer | Mohammad Reza Karimi <m.r.karimi.j@gmail.com> | 2026-01-29 11:40:03 -0500 |
| commit | ab7303e1d893f33e09dbc8493f9a9179a7a40a4a (patch) | |
| tree | aaa279dd2282ef48f4f684768ccb422e0dab30fe /lf/dot-config | |
| parent | e2a70a92822b22633562e9695c300efec2b5cbeb (diff) | |
updates
Diffstat (limited to 'lf/dot-config')
| -rw-r--r-- | lf/dot-config/lf/lfrc | 21 | ||||
| -rwxr-xr-x | lf/dot-config/lf/previewer | 13 |
2 files changed, 25 insertions, 9 deletions
diff --git a/lf/dot-config/lf/lfrc b/lf/dot-config/lf/lfrc index 4d5bd8f..7c367f5 100644 --- a/lf/dot-config/lf/lfrc +++ b/lf/dot-config/lf/lfrc @@ -8,6 +8,7 @@ set icons set scrolloff 10 set period 1 set hiddenfiles ".*:*.aux:*.log:*.bbl:*.bcf:*.blg:*.run.xml" +set previewer "~/.config/lf/previewer" cmd open ${{ case $(file --mime-type "$(readlink -f "$f")" -b) in @@ -31,7 +32,7 @@ cmd extract ${{ while IFS= read -r filename; do filelist+=" $(basename "$filename")" done <<< "$fx" - if ouch decompress "$fx"; then + if safe_extract "$fx"; then lf -remote "send $id echomsg \"Extracted"$filelist" with ouch.\"" else lf -remote "send $id echoerr \"Cannot extract"$filelist" with ouch.\"" @@ -66,11 +67,6 @@ cmd git_branch ${{ lf -remote "send $id updir; cd \"$pwd_shell\"" }} -map gb :git_branch -map gp $clear; git pull --rebase || true; echo "press ENTER"; read ENTER -map gs $clear; git status; echo "press ENTER"; read ENTER -map gl $clear; git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit; echo "press ENTER"; read ENTER - cmd fzf_search ${{ cmd="rg --column --line-number --no-heading --color=always --smart-case" fzf --ansi --disabled --layout=reverse --header="Search in files" --delimiter=: \ @@ -80,8 +76,6 @@ cmd fzf_search ${{ --preview-window='+{2}-/2' \ --preview='bat --color=always --highlight-line={2} -- {1}' }} -map gr :fzf_search - cmd stwify ${{ pkg="$1" @@ -89,12 +83,21 @@ cmd stwify ${{ lf -remote "send $id unselect;" }} +map gb :git_branch +map gp $clear; git pull --rebase || true; echo "press ENTER"; read ENTER +map gs $clear; git status; echo "press ENTER"; read ENTER +map gl $clear; git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit; echo "press ENTER"; read ENTER + +map gr :fzf_search + +map E :extract; reload +map C push :&ouch<space>compress<space>$fx<space>''<left> + map S push :stwify<space>""<left> map Y $printf "%s" "$fx" | wl-copy map <c-n> push :mkdir<space>""<left> map D delete map Q quit-and-cd -map E :extract; reload map <c-f> :fzf_jump map o &mimeopen "$f" map O &mimeopen --ask "$f" diff --git a/lf/dot-config/lf/previewer b/lf/dot-config/lf/previewer new file mode 100755 index 0000000..1ce24f3 --- /dev/null +++ b/lf/dot-config/lf/previewer @@ -0,0 +1,13 @@ +#!/bin/sh + +# Arguments sent to this script: +# (1) current filename, (2) width, (3) height, (4) horizontal position, +# (5) vertical position, and (6) mode ("preview" or "preload") + +case "$(file --dereference --brief --mime-type -- "$1")" in + application/*zip) ouch list "$1";; + */pdf) pdftotext "$1" -;; + text/* | */xml | application/json | application/x-ndjson) bat -p --theme ansi --terminal-width "$(($4-2))" -f "$1";; +esac + +exit 1 |
