Eyes, JAPAN Blog > Colors in command line environment

Colors in command line environment

denvazh

この記事は1年以上前に書かれたもので、内容が古い可能性がありますのでご注意ください。

Reason to have colors at all

Working significant amount of time using mainly command-line tools ( terminal! ), after initial efforts to learn now to make basic shell setup ( .cshrc/.bashrc stuff and alike ) one would want to somehow organize whole text madness on the screen.
For small scripts it might be enough just to see few lines of some text of one color, but for huge scripts having syntax-highlight is crucial.

Coloring up mac environment

Two most frequent tools I use are “less” and “vim”, and of course bash. So, I will mainly concentrate on setting up them.

Enabling syntax-highlight in vim with some additions, that I usually use. For this let’s add lines below to the $HOME/.vimrc:

set background=dark
:colorscheme koehler
syntax on
set number
set nocompatible

Adjusting .bashrc settings ( if necessary ):

export CLICOLOR=1
BREW_PATH="/usr/local"
BREW_BIN="${BREW_PATH}/bin"
export PATH="${BREW_BIN}":$PATH

Enabling syntax-highlight in less ( for Mac ) using previous adjustments:

$: brew install source-highlight
$: echo "export LESSOPEN=\"| ${BREW_BIN}/src-hilite-lesspipe.sh %s\"" >> $HOME/.bashrc && echo "export LESS=' -R '" >> $HOME/.bashrc

I hope this small tips could add some colors to the life of those who mainly use command-line environment.

Comments are closed.