1
0
Fork 0
forked from mirror/nnn

plugins + keybind fix

This commit is contained in:
tezlm 2023-01-21 20:18:27 -08:00
parent 94b349aab7
commit 38b1e9ba14
Signed by: tezlm
GPG key ID: 649733FCD94AFBBA
3 changed files with 15 additions and 9 deletions

8
plugins/celery Executable file
View file

@ -0,0 +1,8 @@
#!/bin/sh
# rsyncs a file to celery.eu.org
name=$(printf "%s.%s" $(petname -w 3) ${1##*.})
rsync -ahvrP4 $1 "celery.eu.org:content/unlist/$name"
echo "unlisted $1 at https://celery.eu.org/unlist/$name"
read _

View file

@ -87,8 +87,8 @@ USE_PISTOL="${USE_PISTOL:-0}"
ICONLOOKUP="${ICONLOOKUP:-0}"
PAGER="${PAGER:-less -P?n -R}"
TMPDIR="${TMPDIR:-/tmp}"
BAT_STYLE="${BAT_STYLE:-numbers}"
BAT_THEME="${BAT_THEME:-ansi}"
BAT_STYLE="${BAT_STYLE:-full}"
BAT_THEME="${BAT_THEME:-default}"
# Consider setting NNN_PREVIEWDIR to $XDG_CACHE_HOME/nnn/previews if you want to keep previews on disk between reboots
NNN_PREVIEWDIR="${NNN_PREVIEWDIR:-$TMPDIR/nnn/previews}"
NNN_PREVIEWWIDTH="${NNN_PREVIEWWIDTH:-1920}"
@ -382,17 +382,13 @@ generate_preview() {
image_preview "$1" "$2" "$3"
return
fi ;;
image) if exists convert; then
convert "$3" -flatten -resize "$NNN_PREVIEWWIDTH"x"$NNN_PREVIEWHEIGHT"\> "$NNN_PREVIEWDIR/$3.jpg"
else
image_preview "$1" "$2" "$3" && return
fi ;;
image) image_preview "$1" "$2" "$3" && return ;;
office) libreoffice --convert-to jpg "$3" --outdir "$NNN_PREVIEWDIR/${3%/*}"
filename="$(printf "%s" "${3##*/}" | cut -d. -f1)"
mv "$NNN_PREVIEWDIR/${3%/*}/$filename.jpg" "$NNN_PREVIEWDIR/$3.jpg" ;;
pdf) pdftoppm -jpeg -f 1 -singlefile "$3" "$NNN_PREVIEWDIR/$3" ;;
djvu) ddjvu -format=ppm -page=1 "$3" "$NNN_PREVIEWDIR/$3.jpg" ;;
video) ffmpegthumbnailer -m -s0 -i "$3" -o "$NNN_PREVIEWDIR/$3.jpg" || rm "$NNN_PREVIEWDIR/$3.jpg" ;;
video) ffmpeg -i "$3" -vf "select=eq(n\,0)" -vframes 1 "$NNN_PREVIEWDIR/$3.jpg" ;;
esac
fi
if [ -f "$NNN_PREVIEWDIR/$3.jpg" ]; then
@ -414,6 +410,8 @@ image_preview() {
catimg "$3" &
elif exists viu; then
viu -t "$3" &
elif exists chafa; then
chafa "$3" &
else
fifo_pager print_bin_info "$3" && return
fi

View file

@ -244,7 +244,7 @@ static struct key bindings[] = {
{ 'o', SEL_OPENWITH },
{ CONTROL('O'), SEL_OPENWITH },
/* Create a new file */
{ 'n', SEL_NEW },
{ 'l', SEL_NEW },
/* Show rename prompt */
{ CONTROL('R'), SEL_RENAME },
/* Rename contents of current dir */