From cca884b02e2cbf5634d6228f8fd5628d365e5bf9 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 9 Mar 2019 12:17:15 -0500 Subject: [PATCH] =?UTF-8?q?vifm=20default=20file=20manager=20w/=20=C3=BCbe?= =?UTF-8?q?rzug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config/vifm/colors/luke.vifm | 33 ++++++++++++++++++++++++++++++ .config/vifm/vifmrc | 38 ++++++++++++++++++----------------- .profile | 2 +- .scripts/tools/vifmimg | 13 ++++++++++++ .scripts/tools/vu | 15 ++++++++++++++ 5 files changed, 82 insertions(+), 19 deletions(-) create mode 100644 .config/vifm/colors/luke.vifm create mode 100755 .scripts/tools/vifmimg create mode 100755 .scripts/tools/vu diff --git a/.config/vifm/colors/luke.vifm b/.config/vifm/colors/luke.vifm new file mode 100644 index 0000000..f3da172 --- /dev/null +++ b/.config/vifm/colors/luke.vifm @@ -0,0 +1,33 @@ +highlight clear +highlight Win cterm=none ctermfg=white ctermbg=black +highlight Directory cterm=bold ctermfg=cyan ctermbg=default +highlight Link cterm=bold ctermfg=blue ctermbg=default +highlight BrokenLink cterm=bold ctermfg=red ctermbg=default +highlight Socket cterm=bold ctermfg=magenta ctermbg=default +highlight Device cterm=bold ctermfg=red ctermbg=default +highlight Fifo cterm=bold ctermfg=cyan ctermbg=default +highlight Executable cterm=bold ctermfg=green ctermbg=default +highlight Selected cterm=bold ctermfg=magenta ctermbg=default +highlight CurrLine cterm=bold,reverse ctermfg=default ctermbg=default +highlight TopLine cterm=none ctermfg=black ctermbg=white +highlight TopLineSel cterm=bold ctermfg=black ctermbg=default +highlight StatusLine cterm=bold ctermfg=black ctermbg=blue +highlight WildMenu cterm=underline,reverse ctermfg=white ctermbg=black +highlight CmdLine cterm=none ctermfg=white ctermbg=black +highlight ErrorMsg cterm=none ctermfg=red ctermbg=black +highlight Border cterm=none ctermfg=white ctermbg=black +highlight JobLine cterm=bold,reverse ctermfg=black ctermbg=white +highlight SuggestBox cterm=bold ctermfg=default ctermbg=default +highlight CmpMismatch cterm=bold ctermfg=white ctermbg=red +highlight AuxWin cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight TabLine cterm=none ctermfg=white ctermbg=black +highlight TabLineSel cterm=bold,reverse ctermfg=default ctermbg=default +highlight User1 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight User2 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight User3 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight User4 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight User5 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight User6 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight User7 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight User8 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default +highlight User9 cterm=bold,underline,reverse,standout,italic ctermfg=default ctermbg=default diff --git a/.config/vifm/vifmrc b/.config/vifm/vifmrc index 06ced49..b05f818 100644 --- a/.config/vifm/vifmrc +++ b/.config/vifm/vifmrc @@ -9,6 +9,7 @@ map o map s map v +map R :restart map x :!sxiv -ft * 2>/dev/null & nnoremap o :file &l map E :!$EDITOR %f @@ -17,30 +18,22 @@ map bg :!setbg %f & nmap tj nmap q ZQ -fileviewer *.html,*.css,*.py,*.c,*.h,*.sh,*.diff,*.tex highlight -O ansi %c +fileviewer *.html,*.css,*.py,*.c,*.h,*.sh,*.diff,*.tex,*.md highlight -O ansi %c fileview */ tree %c -L 1 --dirsfirst fileview ../ tree %c -L 1 --dirsfirst set vicmd=$EDITOR +fileviewer *.docx docx2txt %c - + +filetype *.csv,*.xlsx sc-im %c + set syscalls - set nofollowlinks - -" Natural sort of (version) numbers within text. - set sortnumbers - -" Maximum number of changes that can be undone. - set undolevels=100 - -colorscheme Default - +colorscheme luke set wildmenu - -" Display completions in a form of popup with descriptions of the matches - set wildstyle=popup " Display suggestions in normal, visual and view modes for keys, marks and @@ -78,13 +71,18 @@ endif " %m run the command in a menu window filextype *.pdf,*.ps,*.eps,*.ps.gz,*.djvu zathura %f 2>/dev/null &, -fileviewer *.pdf pdftotext -nopgbrk %c - +fileviewer *.pdf pdftotext -l 1 -nopgbrk %c - " Audio -filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus mpv --input-ipc-server=/tmp/mpvsoc$(date +%%s) %c +filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus mpv --no-audio-display --input-ipc-server=/tmp/mpvsoc$(date +%%s) %c +fileviewer *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus mediainfo %c 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 &, -fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,*.as[fx],*mp3,*.flac mediainfo %c 2>&1 & +"fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob,*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx,*.as[fx],*mp3,*.flac echo %c is a video file. + +fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob, *.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx vifmimg videopreview %px %py %pw %ph %c %pc vifmimg clear + +fileview *.zip,*.rar,*.tar.gz atool -l %f filextype *.html,*.htm firefox %f 2>/dev/null & @@ -94,7 +92,11 @@ filetype *.[1-8] man ./%c fileviewer *.[1-8] man ./%c | col -b filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm rotdir %f 2>/dev/null | sxiv -ia 2>/dev/null & -fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm file %f +"fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm file %f +fileviewer *.jpg,*.jpeg,*.png + \ vifmimg draw %px %py %pw %ph %c + \ %pc + \ vifmimg clear filextype *.svg inkscape %f 2>/dev/null & filextype *.xcf gimp %f 2>/dev/null & diff --git a/.profile b/.profile index dbf59eb..3ce4dfd 100644 --- a/.profile +++ b/.profile @@ -7,7 +7,7 @@ export EDITOR="nvim" export TERMINAL="st" export BROWSER="firefox" export READER="zathura" -export FILE="ranger" +export FILE="vu" export BIB="$HOME/Documents/LaTeX/uni.bib" export REFER="$HOME/Documents/referbib" export SUDO_ASKPASS="$HOME/.scripts/tools/dmenupass" diff --git a/.scripts/tools/vifmimg b/.scripts/tools/vifmimg new file mode 100755 index 0000000..1569962 --- /dev/null +++ b/.scripts/tools/vifmimg @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +[ -z "$FIFO_UEBERZUG" ] && exit + +readonly ID_PREVIEW="preview" + +if [ "$1" = "draw" ]; then + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="${PWD}/$6") > "$FIFO_UEBERZUG" +elif [ "$1" = "videopreview" ]; then + [ ! -f "/tmp/$6.png" ] && ffmpegthumbnailer -i "${PWD}/$6" -o "/tmp/$6.png" -s 0 -q 10 && + declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="/tmp/$6.png") > "$FIFO_UEBERZUG" +else + declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") > "$FIFO_UEBERZUG" +fi diff --git a/.scripts/tools/vu b/.scripts/tools/vu new file mode 100755 index 0000000..778835a --- /dev/null +++ b/.scripts/tools/vu @@ -0,0 +1,15 @@ +#!/usr/bin/env sh +export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}" + +cleanup() { + rm "$FIFO_UEBERZUG" 2>/dev/null + pkill -P $$ 2>/dev/null +} + +rm "$FIFO_UEBERZUG" 2>/dev/null +mkfifo "$FIFO_UEBERZUG" +trap cleanup EXIT +tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash & + +vifm +cleanup