Useful scripts/configurations

| configuration | FreeBSD | Git | Linux | nano | scripts | whitespace

Make git colourful

git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto

Make nano colourful

cp /usr/local/share/examples/nano/nanorc.sample ~/.nanorc
# or
zcat /usr/share/doc/nano/examples/nanorc.sample.gz >~/.nanorc

# then
nano ~/.nanorc

To trim trailing whitespace from *.cc on Linux (taken from this blog):

find . -name '*.cc' -exec sed -i {} -e 's/[ \t]*$//' ';'

and on BSDs:

find . -name '*.cc' -exec sed -i '' -e 's/\ *$//' {} ';'

Linux style ‘ls’ colours on FreeBSD (taken from here):

export CLICOLOR="YES"
export LSCOLORS="ExGxFxdxCxDxDxhbadExEx"

To ensure the http_proxy environmental variable is passed to sudo. Edit the sudoers file by running visudo. Then add the following.

Defaults env_keep += "ftp_proxy http_proxy https_proxy"

Bash autocompletion on FreeBSD:

cd  /usr/ports/shells/bash-completion
sudo make install clean

Edit ~/.bashrc and add

if [ -f /usr/local/etc/bash_completion ]; then
    . /usr/local/etc/bash_completion
fi

Make svn output colorful
Edit ~/.subversion/config

[helpers]
diff-cmd = /usr/bin/colordiff

Create diffs with function names and ignoring whitespace

svn diff -x -uwp

To be continued…