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/pdf zathura

View File

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

View File

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

View File

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