vifm default file manager w/ überzug

This commit is contained in:
Luke Smith 2019-03-09 12:17:15 -05:00
parent 84bf3956f0
commit cca884b02e
5 changed files with 82 additions and 19 deletions

View file

@ -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

View file

@ -9,6 +9,7 @@ map <C-o> <C-w>o
map <C-s> <C-w>s map <C-s> <C-w>s
map <C-v> <C-w>v map <C-v> <C-w>v
map R :restart<CR>
map x :!sxiv -ft * 2>/dev/null &<CR> map x :!sxiv -ft * 2>/dev/null &<CR>
nnoremap o :file &<cr>l nnoremap o :file &<cr>l
map E :!$EDITOR %f<CR> map E :!$EDITOR %f<CR>
@ -17,30 +18,22 @@ map bg :!setbg %f &<CR>
nmap <space> tj nmap <space> tj
nmap q ZQ 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
fileview ../ tree %c -L 1 --dirsfirst fileview ../ tree %c -L 1 --dirsfirst
set vicmd=$EDITOR set vicmd=$EDITOR
fileviewer *.docx docx2txt %c -
filetype *.csv,*.xlsx sc-im %c
set syscalls set syscalls
set nofollowlinks set nofollowlinks
" Natural sort of (version) numbers within text.
set sortnumbers set sortnumbers
" Maximum number of changes that can be undone.
set undolevels=100 set undolevels=100
colorscheme luke
colorscheme Default
set wildmenu set wildmenu
" Display completions in a form of popup with descriptions of the matches
set wildstyle=popup set wildstyle=popup
" Display suggestions in normal, visual and view modes for keys, marks and " 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 " %m run the command in a menu window
filextype *.pdf,*.ps,*.eps,*.ps.gz,*.djvu zathura %f 2>/dev/null &, 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 " 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 &, 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 & filextype *.html,*.htm firefox %f 2>/dev/null &
@ -94,7 +92,11 @@ filetype *.[1-8] man ./%c
fileviewer *.[1-8] man ./%c | col -b fileviewer *.[1-8] man ./%c | col -b
filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm rotdir %f 2>/dev/null | sxiv -ia 2>/dev/null & 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 *.svg inkscape %f 2>/dev/null &
filextype *.xcf gimp %f 2>/dev/null & filextype *.xcf gimp %f 2>/dev/null &

View file

@ -7,7 +7,7 @@ export EDITOR="nvim"
export TERMINAL="st" export TERMINAL="st"
export BROWSER="firefox" export BROWSER="firefox"
export READER="zathura" export READER="zathura"
export FILE="ranger" export FILE="vu"
export BIB="$HOME/Documents/LaTeX/uni.bib" export BIB="$HOME/Documents/LaTeX/uni.bib"
export REFER="$HOME/Documents/referbib" export REFER="$HOME/Documents/referbib"
export SUDO_ASKPASS="$HOME/.scripts/tools/dmenupass" export SUDO_ASKPASS="$HOME/.scripts/tools/dmenupass"

13
.scripts/tools/vifmimg Executable file
View file

@ -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

15
.scripts/tools/vu Executable file
View file

@ -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