Shell: man pager bounded auto-justification

master
Pierre Neidhardt 2013-10-29 15:21:28 +01:00
parent 0b71f5e5de
commit 090f80dc9f
4 changed files with 10 additions and 5 deletions

View File

@ -1,2 +1,2 @@
application/pdf zathura
application/x-tex em application/x-tex em
application/pdf zathura

View File

@ -9,6 +9,8 @@ _printhelp ()
cat <<EOF cat <<EOF
Usage: ${1##*/} [OPTIONS] PACKAGES Usage: ${1##*/} [OPTIONS] PACKAGES
WARNING: development version. Not reliable for AUR-dependency resolution.
This script can perform multiple operations: This script can perform multiple operations:
1. Fetch PKGBUILD. 1. Fetch PKGBUILD.
2. Fetch source code. 2. Fetch source code.
@ -105,8 +107,8 @@ fi
HAS_ABS=false HAS_ABS=false
HAS_YAOURT=false HAS_YAOURT=false
command -v abs >/dev/nulll && HAS_ABS=true command -v abs >/dev/null && HAS_ABS=true
command -v yaourt >/dev/nulll && HAS_YAOURT=true command -v yaourt >/dev/null && HAS_YAOURT=true
if ! $HAS_ABS && ! $HAS_YAOURT; then if ! $HAS_ABS && ! $HAS_YAOURT; then
echo "Please install either an ABS-tree or yaourt." echo "Please install either an ABS-tree or yaourt."

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
_printhelp () _printhelp ()
{ {
cat <<EOF cat <<EOF

View File

@ -10,12 +10,16 @@
## Colored man pager. ## Colored man pager.
man() man()
{ {
# Justify man pager to current window size.
BUF=$(tput cols)
[ $BUF -gt $MANWIDTH ] && BUF=$MANWIDTH
# mb = ? # mb = ?
# md = bold (titles, commands) # md = bold (titles, commands)
# so = status bar # so = status bar
# us = italic (arguments, files) # us = italic (arguments, files)
env \ env \
MANWIDTH=$(tput cols) \ MANWIDTH=$BUF \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \ LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[0;36m") \ LESS_TERMCAP_md=$(printf "\e[0;36m") \
LESS_TERMCAP_me=$(printf "\e[0m") \ LESS_TERMCAP_me=$(printf "\e[0m") \