From 1b290cfa7a46d7f588612455d70c460e6270a297 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Tue, 26 Nov 2019 16:05:29 -0500 Subject: [PATCH] vifm materials readded --- .config/vifm/colors/luke.vifm | 33 +++++++++++++++ .config/vifm/vifmrc | 75 +++++++++++++++++++++++++++++++++++ .local/bin/vifmimg | 13 ++++++ .local/bin/vu | 18 +++++++++ 4 files changed, 139 insertions(+) create mode 100644 .config/vifm/colors/luke.vifm create mode 100644 .config/vifm/vifmrc create mode 100755 .local/bin/vifmimg create mode 100755 .local/bin/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 new file mode 100644 index 0000000..d646f86 --- /dev/null +++ b/.config/vifm/vifmrc @@ -0,0 +1,75 @@ +" vim: filetype=vifm +source ~/.config/vifm/vifmshortcuts + +set vicmd=$EDITOR +set syscalls +set nofollowlinks +set sortnumbers +set undolevels=100 +set wildmenu +set wildstyle=popup +set scrolloff=4 +set ignorecase +set smartcase +set nohlsearch +set incsearch +set suggestoptions=normal,visual,view,otherpane,keys,marks,registers +colorscheme luke + +map h +map j +map k +map l +map o +map s +map v + +map R :restart +map x :!sxiv -ft * 2>/dev/null & +nnoremap o :file & +map E :!$EDITOR %f +map mkd :mkdir +map bg :!setbg %f & +map X :!ext %f & +nnoremap s :shell +nnoremap w :view +vnoremap w :viewgv +nnoremap yd :!echo %d | xclip %i +nnoremap yf :!echo %c:p | xclip %i +nnoremap I cw +nnoremap cc cw +nnoremap A cw +nnoremap ,w :set wrap! +nmap tj +nmap q ZQ + +fileview */ tree %c -L 1 --dirsfirst +fileview ../ tree %c -L 1 --dirsfirst +fileviewer *.html w3m -dump %c +filextype *.html,*.htm firefox %f 2>/dev/null & + +fileviewer *.docx docx2txt %c - +fileviewer *.odt odt2txt %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 file +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 &, + +fileview *.zip,*.rar,*.tar.gz atool -l %f +filetype *.zip,*.rar,*.tar.gz ext %f + +fileviewer *.[1-8] man ./%c | col -b +filetype *.[1-8] man ./%c + +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 | sxiv -ia 2>/dev/null & + +filextype *.svg inkscape %f 2>/dev/null & +filextype *.xcf gimp %f 2>/dev/null & + +set vifminfo=dhistory,chistory,tui,shistory,phistory,fhistory,dirstack,registers,bookmarks,bmarks diff --git a/.local/bin/vifmimg b/.local/bin/vifmimg new file mode 100755 index 0000000..1569962 --- /dev/null +++ b/.local/bin/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/.local/bin/vu b/.local/bin/vu new file mode 100755 index 0000000..1e8d59e --- /dev/null +++ b/.local/bin/vu @@ -0,0 +1,18 @@ +#!/usr/bin/env sh + +# This is a wrapper for vifm to allow ueberzug images. + +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