User:Maffblaster/Drafts/Colorize everything

From Gentoo Wiki
Jump to:navigation Jump to:search

This article provides configuration information, sometimes links to other articles, so that all the things may be colorized.

Software that can be colorized



less requires some extra help by using a syntax highlighter as an input preprocessor (see the LESSOPEN and/or LESSCLOSE environment variables for more details) in order to colorize output. For this example, pygments will used in order to help colorize less' output.

Create a custom ~/.lesspipe file. Gentoo provides a lesspipe file (/usr/bin/lesspipe with the less package itself (sys-apps/less). This file will be automatically sourced by bash, due to the /etc/env.d/70less file.

FILE ~/.lesspipe
case "${1}" in
        pygmentize -f 256 "${1}";;

        pygmentize -f 256 -l sh "${1}";;

        pygmentize -f 256 -l vim "${1}";;

        if grep -q "#\!/bin/bash" "${1}" 2>&1 /dev/null; then
            pygmentize -f 256 -l sh "${1}"
            exit 1

exit 0

Make the new file executable:

user $chmod u+x ~/.lesspipe

Modify the shell's run command file. In this case, bash:

FILE ~/.bashrc
export LESS='-R'
export LESSOPEN='|~/.lesspipe %s'



See Nano#Syntax_highlighting.


The popular vim editor has built-in support for color schemes. The vim core package ships more than a dozen themes and additional themes easily added.