terminal: Create module to consolidate term utils
Terminal application, a variety of shell configurations, terminal file and session management all consolidated in one place.
This commit is contained in:
parent
2e0c992a54
commit
9781b26b22
31 changed files with 0 additions and 0 deletions
25
terminal/.config/vifm/scripts/vifm-default-viewer
Executable file
25
terminal/.config/vifm/scripts/vifm-default-viewer
Executable file
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue