diff --git a/bootstrap/packages.tsv b/bootstrap/packages.tsv index 72acc45..2dc2f6c 100644 --- a/bootstrap/packages.tsv +++ b/bootstrap/packages.tsv @@ -56,6 +56,7 @@ dunst Customizable and lightweight notification-daemon R dust A more intuitive version of du in rust R efm-langserver General purpose Language Server A element-desktop Glossy Matrix collaboration client — desktop version. R +enca Charset analyser and converter R entr Run arbitrary commands when files change R evince Document viewer (PDF, PostScript, XPS, djvu, dvi, tiff, cbr, cbz, cb7, cbt) R exa ls replacement R diff --git a/vifm/.config/vifm/scripts/vifm-default-viewer b/vifm/.config/vifm/scripts/vifm-default-viewer new file mode 100755 index 0000000..b4d0497 --- /dev/null +++ b/vifm/.config/vifm/scripts/vifm-default-viewer @@ -0,0 +1,25 @@ +#!/bin/bash + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 filename" + exit 1 +fi + +# upper limit of lines to display for text files +nlines=250 +# upper limit of bytes to display for binary files +nbytes=2048 +# language of text files +language=russian +# output encoding for text files +encoding=utf-8 + +info=$(head -$nlines "$1" | file --mime -) +charset=${info#*=} + +# shellcheck disable=2268 +if [ "x$charset" == "xbinary" ]; then + hexdump -e '"%08_ax: "' -e '8/1 "%02x " " " 8/1 "%02x "' -e '" |" 16/1 "%_p"' -e '"\n"' -v -n $nbytes "$1" +else + head -$nlines "$1" | enconv -g -L $language -x $encoding +fi diff --git a/vifm/.config/vifm/vifmrc b/vifm/.config/vifm/vifmrc index 85d9e99..0496dac 100644 --- a/vifm/.config/vifm/vifmrc +++ b/vifm/.config/vifm/vifmrc @@ -287,6 +287,11 @@ nnoremap f :fzf nnoremap c :fzfcd nnoremap F :grep +" preview thumbnails of current folder +" select thumbnails with m/M in nsxiv +" to generate a filtered view on them +nnoremap t :!nsxiv -t %u -o %d + " allows preview to work for normal view and single pane view noremap w : if &quickview && !layoutis('only') \| view @@ -406,6 +411,8 @@ filextype *.html,*.htm \ chromium %f &, \ {Open with uzbl} \ google-chrome %f %i &, +fileviewer *.html,*.htm + \ lynx -dump %c filetype *.html,*.htm links, lynx " Object @@ -426,6 +433,8 @@ fileviewer *.gif " Images filextype *.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm + \ {View in nsxiv} + \ nsxiv %f, \ {View in vimiv} \ vimiv %f, \ {View in sxiv} @@ -549,6 +558,9 @@ fileviewer */ \ exa --color always --tree -L2, \ tree -L 2, +" use custom viewer script for rest +fileviewer * vifm-default-viewer %c + " Syntax highlighting in preview " " Explicitly set highlight type for some extensions