packages

By Hal Canary, 2013-05-23 13:53:49 (link)
#computers-code

Bash user? Be sure to install and use the package bash-completion.

Write a lot of code? Don't forget source-highlight

# add to .bashrc
if command -v source-highlight > /dev/null ; then
source-highlight-less() {
    [ $# -eq 0 ] && { echo "args?" >&2; return 1; }
    for FILE ; do
        if [ -f "$FILE" ] ; then
            source-highlight -i "$FILE" -fesc
        else
            echo "${FILE} does not exist" >&2
        fi
    done | less -R -x${TAB:-8}
}
source_to_html() {
    [ $# -eq 0 ] && { echo "args?" >&2; return 1; }
    for FILE ; do
        if [ -f "$FILE" ] ; then
            source-highlight -i "$FILE" -fhtml-css
        else
            echo "${FILE} does not exist" >&2
        fi
    done | expand -t ${TAB:-8}
}
fi

(back)