Wenn ich mir eine Manpage in meiner „Konsole“ ansehe (keine xterm
) Ich sehe eine Färbung, aber ich bekomme diese nicht in meinem xterm
’s (z.B. konsole
) Kann ich das irgendwie aktivieren? hoffentlich eine ziemlich einfache Lösung?
Akzeptierte Antwort:
Sie müssen das termcap(5)
verwenden Merkmal. Die Manpage einiger Unices besagt, dass dieses Tool veraltet ist und terminfo
verwendet werden muss , aber es ist immer noch auf anderen verfügbar (und terminfo
ist komplizierter).
Noch wichtiger, less
verwendet termcap
.
Farben für less
einstellen
Ich mache folgendes damit less
und man
(was less
verwendet ) hat die Farbe:
$ cat ~/.LESS_TERMCAP
export LESS_TERMCAP_mb=$(tput bold; tput setaf 2) # green
export LESS_TERMCAP_md=$(tput bold; tput setaf 6) # cyan
export LESS_TERMCAP_me=$(tput sgr0)
export LESS_TERMCAP_so=$(tput bold; tput setaf 3; tput setab 4) # yellow on blue
export LESS_TERMCAP_se=$(tput rmso; tput sgr0)
export LESS_TERMCAP_us=$(tput smul; tput bold; tput setaf 7) # white
export LESS_TERMCAP_ue=$(tput rmul; tput sgr0)
export LESS_TERMCAP_mr=$(tput rev)
export LESS_TERMCAP_mh=$(tput dim)
export LESS_TERMCAP_ZN=$(tput ssubm)
export LESS_TERMCAP_ZV=$(tput rsubm)
export LESS_TERMCAP_ZO=$(tput ssupm)
export LESS_TERMCAP_ZW=$(tput rsupm)
export GROFF_NO_SGR=1 # For Konsole and Gnome-terminal
Und dann in meinem ~/.bashrc
, mache ich das:
# Get color support for 'less'
export LESS="--RAW-CONTROL-CHARS"
# Use colors for less, man, etc.
[[ -f ~/.LESS_TERMCAP ]] && . ~/.LESS_TERMCAP
HINWEIS: Siehe Dokumentation zu LESS_TERMCAP_*
Variablen? wie das funktioniert.
Das Endergebnis