Lots of changes in vifm and sxiv configs

This commit is contained in:
Wiktor Zykubek 2020-05-16 17:49:43 +02:00
parent 9f546de3cc
commit 837e0c857d
9 changed files with 144 additions and 64 deletions

View File

@ -3,6 +3,7 @@
"============== "==============
" Leader key " Leader key
let mapleader = ' ' let mapleader = ' '
let g:move_key_modifier = 'A'
"~~~~~ "~~~~~
" Git " Git

View File

@ -7,7 +7,8 @@ alias \
v='nvim' \ v='nvim' \
vi='nvim' \ vi='nvim' \
vim='nvim' \ vim='nvim' \
suvi='sudo -E nvim' suvi='sudo -E nvim' \
vifm='vifmrun'
alias \ alias \
l='ls' \ l='ls' \

View File

@ -3,6 +3,19 @@
while read -r file while read -r file
do do
case "$1" in case "$1" in
"w") setwall "$file" &;; "w")
setwall "$file" & ;;
"y")
readlink -f "$file" | xclip -selection clipboard &&
notify-send "\"$file\" copied to clipboard" & ;;
"Y")
xclip -selection clipboard -t image/png < $(readlink -f "$file") &&
notify-send -i "$(readlink -f "$file")" "copied to clipboard" & ;;
"d")
[ "$(printf "No\\nYes" | \
rofi -dmenu -i -l 2 -p "Really delete $file?")" = "Yes" ] &&
rm "$file" && notify-send "\"$file\" deleted." ;;
"g")
isinstalled gimp && pkill sxiv && gimp "$file" & ;;
esac esac
done done

View File

@ -11,31 +11,34 @@
hi clear hi clear
hi Win ctermfg=white ctermbg=none cterm=none hi Win ctermfg=white ctermbg=none cterm=none
hi Directory ctermfg=blue ctermbg=default cterm=bold hi Directory ctermfg=blue ctermbg=default cterm=bold
hi Link ctermfg=cyan ctermbg=default cterm=none hi Link ctermfg=cyan ctermbg=default
hi BrokenLink ctermfg=red ctermbg=default cterm=bold hi BrokenLink ctermfg=red ctermbg=default cterm=bold
hi Socket ctermfg=magenta ctermbg=default cterm=bold hi Socket ctermfg=magenta ctermbg=default cterm=bold
hi Device ctermfg=red ctermbg=default cterm=bold hi Device ctermfg=red ctermbg=default cterm=bold
hi Fifo ctermfg=red ctermbg=default cterm=bold hi Fifo ctermfg=red ctermbg=default cterm=bold
hi Executable ctermfg=green ctermbg=default cterm=bold hi Executable ctermfg=green ctermbg=default cterm=bold
hi Selected ctermfg=black ctermbg=8 cterm=bold hi Selected ctermfg=192 ctermbg=234 cterm=italic
hi CurrLine ctermfg=8 ctermbg=white cterm=bold,reverse hi CurrLine ctermfg=8 ctermbg=191 cterm=bold,reverse
hi TopLine ctermfg=none ctermbg=none cterm=none hi OtherLine ctermfg=191 ctermbg=none
hi OtherLine ctermfg=7 ctermbg=none hi TopLine ctermfg=none ctermbg=none cterm=none
hi TopLineSel ctermfg=white ctermbg=none cterm=bold hi TopLineSel ctermfg=white ctermbg=none cterm=bold
hi StatusLine ctermfg=4 ctermbg=none cterm=none hi StatusLine ctermfg=4 ctermbg=none cterm=none
hi WildMenu ctermfg=4 ctermbg=black cterm=reverse hi WildMenu ctermfg=4 ctermbg=black cterm=reverse
hi CmdLine ctermfg=7 ctermbg=none cterm=none hi CmdLine ctermfg=7 ctermbg=none cterm=none
hi ErrorMsg ctermfg=red ctermbg=233 cterm=none hi ErrorMsg ctermfg=red ctermbg=233 cterm=none
hi Border ctermfg=black ctermbg=none cterm=none hi Border ctermfg=black ctermbg=none cterm=none
hi JobLine ctermfg=black ctermbg=white cterm=none,reverse hi JobLine ctermfg=black ctermbg=white cterm=none,reverse
hi SuggestBox ctermfg=8 ctermbg=233 cterm=none hi SuggestBox ctermfg=8 ctermbg=233 cterm=none
hi CmpMismatch ctermfg=white ctermbg=red cterm=bold hi CmpMismatch ctermfg=white ctermbg=red cterm=bold
hi AuxWin ctermfg=default ctermbg=default cterm=none,underline,reverse,standout,italic hi AuxWin ctermfg=default ctermbg=default cterm=none,underline,reverse,standout,italic
hi TabLine ctermfg=9 ctermbg=0 cterm=none hi TabLine ctermfg=9 ctermbg=0 cterm=none
hi TabLineSel ctermfg=default ctermbg=default cterm=none,reverse hi TabLineSel ctermfg=default ctermbg=default cterm=none,reverse
hi /^.*\.(mp3|ogg|oga|flac|m4a)$/ ctermfg=magenta hi /^.*\.(mp3|ogg|oga|flac|m4a)$/ ctermfg=13
hi /^.*\.(jpg|jpeg|png|gif|tiff|webp|bmp|svg|svgz)$/ ctermfg=yellow hi /^.*\.(flv|mp4|webm|mkv)$/ ctermfg=13
hi /^.*\.(zip|gz|bz2|xz|tar|tgz|tbz2|7z|rar|iso|rpm|deb)$/ ctermfg=red hi /^.*\.(jpg|jpeg|png|gif|tiff|webp|bmp|svg|svgz)$/ ctermfg=11
hi /^.*\.(zip|gz|bz2|lz4|xz|tar|tgz|tbz2|7z|rar|iso|rpm|deb)$/ ctermfg=167 cterm=bold
hi /^.*\.(docx|odt|pptx|odp)$/ ctermfg=60
hi /^.*\.(pdf)$/ ctermfg=61

View File

@ -38,21 +38,20 @@ mark b ~/bin/
mark h ~/ mark h ~/
" Sample mappings " Sample mappings
unmap u
nnoremap ` :cd ~<cr> nnoremap ` :cd ~<cr>
nnoremap ~ :cd ~<cr> nnoremap ~ :cd ~<cr>
nnoremap S :shell<cr> nnoremap S :source ~/.config/vifm/vifmrc; source ~/.config/vifm/colors/biual.vifm<cr>
nnoremap q :q<cr> nnoremap q :q<cr>
nnoremap s :select<cr> nnoremap s :select<cr>
nnoremap u :unselect<cr>
nnoremap w :view<cr> nnoremap w :view<cr>
vnoremap w :view<cr>gv vnoremap w :view<cr>gv
nnoremap cc cw<c-u> nnoremap cc cw<c-u>
nnoremap I za<c-u> nnoremap I za<c-u>
nnoremap x :!sxiv -btf *<Cr>
nnoremap <C-A-j> <C-w><C-j> unmap Y
nnoremap <C-A-k> <C-w><C-k> nnoremap Y :!xclip -selection clipboard -t image/png < %c<cr>:echo expand('%"c:p') "is copied to clipboard"<cr>
nnoremap <C-A-l> <C-w><C-l>
nnoremap <C-A-h> <C-w><C-h>
" ------------------------------------------------------------------------------ " ------------------------------------------------------------------------------
@ -170,16 +169,8 @@ filetype *.[1-8] man ./%c
fileviewer *.[1-8] man ./%c | col -b fileviewer *.[1-8] man ./%c | col -b
" Images " Images
filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.ico,*.gif,*.xpm vifmimg draw %px %py %pw %ph %c %pc vifmimg clear
\ {View in feh} filextype *.bmp,*.jpg,*.jpeg,*.png,*.ico,*.gif,*.xpm sxiv -fb 2>/dev/null &
\ sxiv -b -f
fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm
\ gimp %f
" OpenRaster
filextype *.ora
\ {Edit in MyPaint}
\ mypaint %f,
" Mindmap " Mindmap
filextype *.vym filextype *.vym
@ -212,8 +203,7 @@ filetype *.asc
\ !!gpg --verify %c, \ !!gpg --verify %c,
" Torrent " Torrent
filetype *.torrent ktorrent %f & filetype *.torrent torradd %f &
fileviewer *.torrent dumptorrent -v %c
" FuseZipMount " FuseZipMount
filetype *.zip,*.jar,*.war,*.ear,*.oxt,*.apkg filetype *.zip,*.jar,*.war,*.ear,*.oxt,*.apkg
@ -262,22 +252,17 @@ filetype *.7z
fileviewer *.7z 7z l %c fileviewer *.7z 7z l %c
" Office files " Office files
filextype *.odt,*.doc,*.docx,*.xls,*.xlsx,*.odp,*.pptx libreoffice %f & filextype *.odt,*.doc,*.docx,*.xls,*.xlsx,*.odp,*.pptx, *.ppt libreoffice %f &
fileviewer *.doc catdoc %c fileviewer *.doc catdoc %c
fileviewer *.docx docx2txt.pl %f - fileviewer *.docx docx2txt.pl %f -
" TuDu files " TuDu files
filetype *.tudu tudu -f %c filetype *.tudu tudu -f %c
" Qt projects
filextype *.pro qtcreator %f &
" Directories
filextype */
\ {View in thunar}
\ Thunar %f &,
filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus mpv --no-audio-display --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
" Syntax highlighting in preview " Syntax highlighting in preview
fileviewer * highlight -O ansi -s dante %c
" "
" Explicitly set highlight type for some extensions " Explicitly set highlight type for some extensions
" "
@ -286,7 +271,6 @@ filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus mpv -
" fileviewer Makefile,Makefile.* highlight -O xterm256 -s dante --syntax make %c " fileviewer Makefile,Makefile.* highlight -O xterm256 -s dante --syntax make %c
" "
" 16-color terminal " 16-color terminal
" fileviewer *.c,*.h highlight -O ansi -s dante %c
" "
" Or leave it for automatic detection " Or leave it for automatic detection
" "

View File

@ -2,4 +2,4 @@
# File manager. # File manager.
"$TERMINAL" -e vifm "$TERMINAL" -e vifmrun

View File

@ -8,17 +8,17 @@ mkdir -p ~/pix/Screenshots
screen_path=~/pix/Screenshots/$(date +%G-%m-%d_%s).png screen_path=~/pix/Screenshots/$(date +%G-%m-%d_%s).png
screenshot() { screenshot() {
maim $type "$screen_path" && maim $type "$screen_path" &&
notify-send -u low -t 1400 -i "$screen_path" "Screenshot created!" notify-send -u low -t 1400 -i "$screen_path" "Screenshot created!"
} }
[ "$1" = "--force" ] && { screenshot && exit; } [ "$1" = "--force" ] && { screenshot && exit; }
type="$(printf " Screen\n Area\n" | m 2 -p 'Screenshoter')" type="$(printf " Screen\n Area\n" | m 2 -p 'Screenshoter')"
[ ! "$type" ] && exit [ ! "$type" ] && exit
save="$(printf " No\n Yes" | m 2 -p 'Copy?')" save="$(printf " No\n Yes" | m 2 -p 'Copy?')"
[ ! "$save" ] && exit [ ! "$save" ] && exit
time="$(printf "0.7\n5\n10\n15" | m 3 -p 'Delay')" time="$(printf "0.7\n5\n10\n15" | m 3 -p 'Delay')"
[ ! "$time" ] && exit [ ! "$time" ] && exit
[ "$type" = " Area" ] && type="-s -u" || type="" [ "$type" = " Area" ] && type="-s -u" || type=""
@ -27,5 +27,5 @@ sleep "$time"
screenshot screenshot
[ "$save" = " Yes" ] && [ "$save" = " Yes" ] &&
xclip -sel clip /dev/null; sleep 0.5 xclip -sel clip /dev/null; sleep 0.5
xclip -selection clipboard -t image/png "$screen_path" || exit xclip -selection clipboard -t image/png "$screen_path" || exit

56
.local/bin/scripts/vifmimg Executable file
View File

@ -0,0 +1,56 @@
#!/usr/bin/env bash
# Preview images in vifm via ueberzug.
readonly ID_PREVIEW="preview"
#AUTO_REMOVE="yes"
# By enabling this option the script will remove the preview file after it is drawn
# and by doing so the preview will always be up-to-date with the file.
# This however, requires more CPU and therefore affects the overall performance.
if [ -e "$FIFO_UEBERZUG" ]; then
if [[ "$1" == "draw" ]]; then
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW"
[x]="$2" [y]="$3" [width]="$4" [height]="$5" \
[path]="${PWD}/$6") \
> "$FIFO_UEBERZUG"
elif [[ "$1" == "videopreview" ]]; then
echo -e "Loading preview..\nFile: $6"
[[ ! -d "/tmp${PWD}/$6/" ]] && mkdir -p "/tmp${PWD}/$6/"
[[ ! -f "/tmp${PWD}/$6.png" ]] && ffmpegthumbnailer -i "${PWD}/$6" -o "/tmp${PWD}/$6.png" -s 0 -q 10
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW"
[x]="$2" [y]="$3" [width]="$4" [height]="$5" \
[path]="/tmp${PWD}/$6.png") \
> "$FIFO_UEBERZUG"
elif [[ "$1" == "gifpreview" ]]; then
echo -e "Loading preview..\nFile: $6"
[[ ! -d "/tmp${PWD}/$6/" ]] && mkdir -p "/tmp${PWD}/$6/" && convert -coalesce "${PWD}/$6" "/tmp${PWD}/$6/$6.png"
for frame in $(ls -1 /tmp${PWD}/$6/$6*.png | sort -V); do
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW"
[x]="$2" [y]="$3" [width]="$4" [height]="$5" \
[path]="$frame") \
> "$FIFO_UEBERZUG"
# Sleep between frames to make the animation smooth.
sleep .07
done
elif [[ "$1" == "pdfpreview" ]]; then
echo -e "Loading preview..\nFile: $6"
[[ ! -d "/tmp${PWD}/$6/" ]] && mkdir -p "/tmp${PWD}/$6/"
[[ ! -f "/tmp${PWD}/$6.png" ]] && pdftoppm -png -singlefile "$6" "/tmp${PWD}/$6"
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW"
[x]="$2" [y]="$3" [width]="$4" [height]="$5" \
[path]="/tmp${PWD}/$6.png") \
> "$FIFO_UEBERZUG"
elif [[ "$1" == "clear" ]]; then
declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") \
> "$FIFO_UEBERZUG"
[[ ! -z $AUTO_REMOVE ]] && [[ -f "/tmp${PWD}/$6.png" ]] && rm -f "/tmp${PWD}/$6.png"
[[ ! -z $AUTO_REMOVE ]] && [[ -d "/tmp${PWD}/$6/" ]] && rm -rf "/tmp${PWD}/$6/"
fi
fi

22
.local/bin/scripts/vifmrun Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Run vifm with ueberzug support.
export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}"
function 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 &
if [ -n "$1" ]; then
vifm $1 $2
else
vifm $(pwd) $(pwd)
fi
cleanup