vifm: refactor previews
This commit is contained in:
parent
b63603a18d
commit
781c670d3c
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ "$#" -ne 3 ]; then
|
||||
echo "Usage: $0 filename width height"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dim=( $(exiftool -p '$ImageWidth $ImageHeight' "$1") )
|
||||
|
||||
pw=$(($2*8))
|
||||
ph=$(($3*14))
|
||||
|
||||
w=${dim[0]}
|
||||
h=${dim[1]}
|
||||
|
||||
height=auto
|
||||
width=auto
|
||||
if [ $pw -lt $w ] && [ $ph -lt $h ]; then
|
||||
newh=$(echo "($h*$pw)/$w" | bc)
|
||||
neww=$(echo "($w*$ph)/$h" | bc)
|
||||
|
||||
if [ $newh -le $ph ]; then
|
||||
width=$pw
|
||||
else
|
||||
height=$ph
|
||||
fi
|
||||
elif [ $pw -lt $w ]; then
|
||||
width=$pw
|
||||
elif [ $ph -lt $h ]; then
|
||||
height=$ph
|
||||
fi
|
||||
|
||||
# account for GNU screen
|
||||
if [ -n "$STY" ]; then
|
||||
popt=-P
|
||||
fi
|
||||
|
||||
exec img2sixel $popt --width=$width --height=$height "$1"
|
|
@ -42,28 +42,24 @@ nnoremap ,w :set wrap!<cr>
|
|||
nmap <space> tj
|
||||
nmap q ZQ
|
||||
|
||||
fileviewer *.html elinks -dump %c
|
||||
filextype *.html,*.htm $BROWSER %f 2>/dev/null &
|
||||
|
||||
fileviewer *.docx docx2txt %c -
|
||||
fileviewer *.odt odt2txt %c -
|
||||
fileviewer <text/html> lynx -dump %c
|
||||
|
||||
filetype *.csv,*.xlsx sc-im %c
|
||||
fileviewer *.csv sed "s/,,,,/,,-,,/g;s/,,/ /g" %c | column -t | sed "s/ - / /g" | cut -c -%pw
|
||||
|
||||
filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus mpv --no-audio-display --input-ipc-server=/tmp/mpvsoc$(date +%%s) %c
|
||||
filextype *.pdf,*.ps,*.eps,*.ps.gz,*.djvu,*.epub zathura %f 2>/dev/null &,
|
||||
fileviewer *.pdf pdftotext -l 1 -nopgbrk %c -
|
||||
fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.qt,*.divx,*.as[fx],*mp3,*.flac mediainfo
|
||||
filextype *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,*.as[fx] mpv --input-ipc-server=/tmp/mpvsoc$(date +%%s) %f 2>/dev/null &,
|
||||
filetype *.pdf,*.ps,*.eps,*.ps.gz,*.djvu,*.epub zathura %f 2>/dev/null &
|
||||
|
||||
fileview *.zip,*.rar,*.tar.gz atool -l %f
|
||||
filetype *.zip,*.rar,*.tar.gz,*.iso,*.xz,*.tar,*.tgz aunpack %f
|
||||
fileviewer *.zip,*.rar,*.tar.gz atool -l %f
|
||||
|
||||
fileviewer *.[1-8] man ./%c | col -b
|
||||
filetype *.[1-8] man ./%c
|
||||
fileviewer *.[1-8] man ./%c | col -b
|
||||
|
||||
fileviewer *.jpg,*.jpeg,*.png,*.ico vifmimg draw %px %py %pw %ph %c %pc vifmimg clear
|
||||
filextype *.bmp,*.jpg,*.jpeg,*.png,*.ico,*.gif,*.xpm rotdir %f 2>/dev/null | imv 2>/dev/null &
|
||||
filetype <audio/*> mpv --no-audio-display %c
|
||||
filetype <video/*> mpv %f 2>/dev/null &
|
||||
fileviewer <audio/*,video/*> mediainfo
|
||||
|
||||
filetype <image/*> rotdir %f 2>/dev/null | imv 2>/dev/null &
|
||||
fileviewer <image/*> sixel %c %pw %ph %pd %pc
|
||||
|
||||
set vifminfo=dhistory,chistory,tui,shistory,phistory,fhistory,dirstack,registers,bookmarks,bmarks
|
||||
|
|
Loading…
Reference in New Issue