1
0
Fork 0

small improvements

This commit is contained in:
Luca Bilke 2023-06-15 17:27:56 +02:00
parent 2e67bb28b3
commit b4ecb71d0b
No known key found for this signature in database
GPG Key ID: 7B77C51E8C779E75
5 changed files with 39 additions and 17 deletions

View File

@ -9,6 +9,7 @@ set wrapscroll
set period 1
set previewer ~/.config/lf/preview
set cleaner ~/.config/lf/clean
set drawbox
# promptfmt is set in the on-cd command
cmd open $set -f; rifle -c $XDG_CONFIG_HOME/lf/rifle.conf -p 0 $fx; clear
@ -111,13 +112,7 @@ cmd paste &{{
mode="$1"
shift
case "$mode" in
copy)
rsync -av --ignore-existing --progress -- "$@" . |
stdbuf -i0 -o0 -e0 tr '\r' '\n' |
while IFS= read -r line; do
lf -remote "send $id echo $line"
done
;;
copy) cp -rn -- "$@" .;;
move) mv -n -- "$@" .;;
esac
rm ~/.local/share/lf/files
@ -170,6 +165,16 @@ cmd fzfshortcutdirs ${{
[ -d $file ] && lf -remote "send $id cd $file"
lf -remote "send $id select $file"
}}
cmd fzfgrep ${{
RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case "
res="$(
FZF_DEFAULT_COMMAND="$RG_PREFIX ''" \
fzf --bind "change:reload:$RG_PREFIX {q} || true" \
--ansi --layout=reverse --header 'Search in files' \
| cut -d':' -f1 | sed 's/\\/\\\\/g;s/"/\\"/g'
)"
[ -n "$res" ] && lf -remote "send $id select \"$res\""
}}
# Bindings
map <c-c>a fzfsearch
@ -177,6 +182,7 @@ map <c-c>t fzftags
map <c-c>m fzfmarks
map <c-c>f fzfshortcutfiles
map <c-c>d fzfshortcutdirs
map <c-c>g fzfgrep
map J $dir=$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf) && lf -remote "send $id cd $(eval echo $dir)"
map D trash
map <c-d> delete
@ -195,9 +201,7 @@ map <enter> shell
map x $$f
map X !$f
map o open-with
map A rename # at the very end
map a push A<c-a> # at the very beginning
map I push A<a-b> # after extension
map i push A<a-b><a-b><a-f> # before extension
map c push A<c-u> # new rename
map B bulkrename
@ -205,14 +209,9 @@ map b dupe
map u :clear; unselect
map n &echo $f | xclip -r -selection c
map <esc> quit
map N
map g/ cd "/"
map W &setsid $TERMINAL -e $SHELL -c "lf; $SHELL"
map W &setsid $TERMINAL -e lf
map e edit
# Kitty Specific
map W &setsid $TERMINAL $SHELL -c "lf; exec $SHELL"
# Load bookmark shortcuts
source "~/.config/lf/shortcutrc"

View File

@ -11,7 +11,7 @@ image() {
y=$5
# kitty +kitten icat --clear --stdin no --silent --transfer-mode memory --place "${w}x${h}@${x}x${y}" "$f" >/dev/tty
if [ -f "$1" ] && [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1; then
printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$5" "$(($2-1))" "$(($3-1))" "$1" > "$FIFO_UEBERZUG"
printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$(($4 + 3))" "$(($5 + 1))" "$(($2-6))" "$(($3-2))" "$1" > "$FIFO_UEBERZUG"
fi
exit 1
}

View File

@ -93,6 +93,7 @@ export W3M_DIR="$XDG_DATA_HOMEA/w3m"
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
localpath="$(find -L ~/.local/bin -type d -printf %p: | sed 's/.$//')"
fpath=($XDG_CONFIG_HOME/zsh/completions $fpath)
export PATH="$PATH:$HOME/.local/share/npm-global/bin:$localpath"
export NVM_DIR="$HOME/.config/nvm"

View File

@ -0,0 +1,22 @@
#compdef lf
local arguments
arguments=(
'-command[command to execute on client initialization]'
'-config[path to the config file (instead of the usual paths)]'
'-cpuprofile[path to the file to write the CPU profile]'
'-doc[show documentation]'
'-last-dir-path[path to the file to write the last dir on exit (to use for cd)]'
'-log[path to the log file to write messages]'
'-memprofile[path to the file to write the memory profile]'
'-remote[send remote command to server]'
'-selection-path[path to the file to write selected files on open (to use as open file dialog)]'
'-server[start server (automatic)]'
'-single[start a client without server]'
'-version[show version]'
'-help[show help]'
'*:filename:_files'
)
_arguments -s $arguments

View File

@ -57,7 +57,7 @@ fi
# Misc.
alias \
ll="ls -alhN --color=auto --group-directories-first" \
ll="ls -lhpAN --color=auto --group-directories-first" \
subpush="git push --recurse-submodules=on-demand" \
ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \
weath="less -S ${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" \