wheeeeee lf
This commit is contained in:
parent
fc00db05bf
commit
a4a1cb0242
@ -41,5 +41,5 @@ image/png=nsxiv.desktop
|
|||||||
image/jpg=nsxiv.desktop
|
image/jpg=nsxiv.desktop
|
||||||
application/json=codium.desktop
|
application/json=codium.desktop
|
||||||
application/xml=codium.desktop
|
application/xml=codium.desktop
|
||||||
inode/directory=pcmanfm.desktop
|
inode/directory=file.desktop;pcmanfm.desktop
|
||||||
text/plain=codium.desktop
|
text/plain=codium.desktop
|
||||||
|
18
fish/.config/fish/functions/lfcd.fish
Normal file
18
fish/.config/fish/functions/lfcd.fish
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Change working dir in fish to last dir in lf on exit (adapted from ranger).
|
||||||
|
#
|
||||||
|
# You may put this file to a directory in $fish_function_path variable:
|
||||||
|
#
|
||||||
|
# mkdir -p ~/.config/fish/functions
|
||||||
|
# ln -s "/path/to/lfcd.fish" ~/.config/fish/functions
|
||||||
|
#
|
||||||
|
# You may also like to assign a key (Ctrl-O) to this command:
|
||||||
|
#
|
||||||
|
# bind \co 'set old_tty (stty -g); stty sane; lfcd; stty $old_tty; commandline -f repaint'
|
||||||
|
#
|
||||||
|
# You may put this in a function called fish_user_key_bindings.
|
||||||
|
|
||||||
|
function lfcd --wraps="lf" --description="lf - Terminal file manager (changing directory on exit)"
|
||||||
|
# `command` is needed in case `lfcd` is aliased to `lf`.
|
||||||
|
# Quotes will cause `cd` to not change directory if `lf` prints nothing to stdout due to an error.
|
||||||
|
cd "$(command lf -print-last-dir $argv)"
|
||||||
|
end
|
@ -14,7 +14,7 @@ cmd edit-config ${{
|
|||||||
|
|
||||||
cmd open ${{
|
cmd open ${{
|
||||||
switch $(file --mime-type "$(readlink -f $f)" -b)
|
switch $(file --mime-type "$(readlink -f $f)" -b)
|
||||||
case image/vnd.djvu application/pdf application/octet-stream application/postscript
|
case image/vnd.djvu application/pdf application/octet-stream application/postscript application/pdf application/vnd.djvu "application/epub*"
|
||||||
setsid -f zathura $fx >/dev/null 2>&1
|
setsid -f zathura $fx >/dev/null 2>&1
|
||||||
case "text/*" application/json inode/x-empty application/x-subrip
|
case "text/*" application/json inode/x-empty application/x-subrip
|
||||||
$EDITOR $fx
|
$EDITOR $fx
|
||||||
@ -22,49 +22,62 @@ cmd open ${{
|
|||||||
setsid -f gimp $f >/dev/null 2>&1
|
setsid -f gimp $f >/dev/null 2>&1
|
||||||
case image/svg+xml
|
case image/svg+xml
|
||||||
display -- $f
|
display -- $f
|
||||||
#case "image/*"
|
case "image/*"
|
||||||
# rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*$" |
|
rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*\$" |
|
||||||
# setsid -f nsxiv -aio 2>/dev/null |
|
setsid -f nsxiv -aio 2>/dev/null |
|
||||||
# while read -r file [ -z "$file" ] && continue; lf -remote "send select \"$file\""; lf -remote "send toggle"; end
|
while read -r file;
|
||||||
|
[ -z "$file" ] && continue;
|
||||||
|
lf -remote "send select \"$file\"";
|
||||||
|
lf -remote "send toggle";
|
||||||
|
end
|
||||||
case "audio/*" video/x-ms-asf
|
case "audio/*" video/x-ms-asf
|
||||||
mpv --volume=45 --audio-display=no $f
|
mpv --volume=45 --audio-display=no $f
|
||||||
case "video/*"
|
case "video/*"
|
||||||
setsid -f mpv --volume=45 $f -quiet >/dev/null 2>&1
|
setsid -f mpv --volume=45 $f -quiet >/dev/null 2>&1
|
||||||
case application/pdf application/vnd.djvu "application/epub*"
|
|
||||||
setsid -f zathura $fx >/dev/null 2>&1
|
|
||||||
case application/pgp-encrypted
|
case application/pgp-encrypted
|
||||||
$EDITOR $fx
|
$EDITOR $fx
|
||||||
case application/vnd.openxmlformats-officedocument.wordprocessingml.document application/vnd.oasis.opendocument.text application/vnd.openxmlformats-officedocument.spreadsheetml.sheet application/octet-stream application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.spreadsheet-template application/vnd.openxmlformats-officedocument.presentationml.presentation application/vnd.oasis.opendocument.presentation-template application/vnd.oasis.opendocument.presentation application/vnd.ms-powerpoint application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.graphics-template application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.database
|
case application/vnd.openxmlformats-officedocument.wordprocessingml.document application/vnd.oasis.opendocument.text application/vnd.openxmlformats-officedocument.spreadsheetml.sheet application/octet-stream application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.spreadsheet-template application/vnd.openxmlformats-officedocument.presentationml.presentation application/vnd.oasis.opendocument.presentation-template application/vnd.oasis.opendocument.presentation application/vnd.ms-powerpoint application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.graphics-template application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.database
|
||||||
setsid -f libreoffice $fx >/dev/null 2>&1
|
setsid -f libreoffice $fx >/dev/null 2>&1
|
||||||
case "*"
|
case "*"
|
||||||
for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done
|
for f in $fx
|
||||||
|
setsid -f $OPENER $f >/dev/null 2>&1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
}}
|
}}
|
||||||
|
|
||||||
cmd bulkrename ${{
|
cmd bulkrename ${{
|
||||||
tmpfile_old="$(mktemp)"
|
set tmpfile_old (mktemp)
|
||||||
tmpfile_new="$(mktemp)"
|
set tmpfile_new (mktemp)
|
||||||
|
|
||||||
[ -n "$fs" ] && fs=$(basename -a $fs) || fs=$(ls)
|
if test -n "$fs"
|
||||||
|
set fs (basename -a $fs)
|
||||||
|
else
|
||||||
|
set fs (ls)
|
||||||
|
end
|
||||||
|
|
||||||
echo "$fs" > "$tmpfile_old"
|
echo "$fs" > "$tmpfile_old"
|
||||||
echo "$fs" > "$tmpfile_new"
|
echo "$fs" > "$tmpfile_new"
|
||||||
$EDITOR "$tmpfile_new"
|
$EDITOR "$tmpfile_new"
|
||||||
|
|
||||||
[ "$(wc -l < "$tmpfile_old")" -eq "$(wc -l < "$tmpfile_new")" ] || { rm -f "$tmpfile_old" "$tmpfile_new"; exit 1; }
|
if test (wc -l < "$tmpfile_old") -eq (wc -l < "$tmpfile_new")
|
||||||
|
paste "$tmpfile_old" "$tmpfile_new" | while IFS="$(printf '\t')" read -r src dst
|
||||||
paste "$tmpfile_old" "$tmpfile_new" | while IFS="$(printf '\t')" read -r src dst
|
if test "$src" = "$dst" -o -e "$dst"
|
||||||
do
|
mv -- "$src" "$dst"
|
||||||
[ "$src" = "$dst" ] || [ -e "$dst" ] || mv -- "$src" "$dst"
|
end
|
||||||
done
|
end
|
||||||
|
else
|
||||||
|
rm -f "$tmpfile_old" "$tmpfile_new"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
rm -f "$tmpfile_old" "$tmpfile_new"
|
rm -f "$tmpfile_old" "$tmpfile_new"
|
||||||
lf -remote "send $id unselect"
|
lf -remote "send $id unselect"
|
||||||
}}
|
}}
|
||||||
|
|
||||||
cmd move-parent &{{
|
cmd move-parent &{{
|
||||||
dironly="setlocal '$(dirname "$PWD")' dironly"
|
|
||||||
lf -remote "send $id :updir; $dironly true; $1; $dironly false; open"
|
set dironly "setlocal (dirname "$PWD") dironly"
|
||||||
|
lf -remote "send $id :updir; $dironly true; $argv; $dironly false; open"
|
||||||
}}
|
}}
|
||||||
|
|
||||||
### Mappings and stuff ###
|
### Mappings and stuff ###
|
||||||
|
Loading…
Reference in New Issue
Block a user