]> ruderich.org/simon Gitweb - config/dotfiles.git/blobdiff - shell/shell/aliases.in
shell: add man wrapper to restore colored and searchable man pages
[config/dotfiles.git] / shell / shell / aliases.in
index a4db8bfee044f0856faa3238e26d00d252eb294e..384d6e5a527098d9038e751e25ac0cd2ff8df09d 100644 (file)
@@ -123,6 +123,14 @@ tree() {
     command tree -C "$@" | less -S
 }
 
+# Modern Groff versions (at least on Debian) don't support LESS_TERMCAP_* to
+# color man pages, set GROFF_NO_SGR as workaround. Also set LANG to C so that
+# hyphens are not replaced with unicode making it impossible to search for
+# options containg "-" or "--" in many man pages.
+man() {
+    GROFF_NO_SGR=1 LANG=C command man "$@"
+}
+
 # Better viewer for info pages .. just pipe everything into less.
 info() {
     command info "$@" 2>/dev/null | less