Skip to content

Instantly share code, notes, and snippets.

@0x3333
Last active February 1, 2022 22:45
Show Gist options
  • Save 0x3333/2bad186dd9c0f045c0d0 to your computer and use it in GitHub Desktop.
Save 0x3333/2bad186dd9c0f045c0d0 to your computer and use it in GitHub Desktop.
Oh My Zsh plugin to colourize commands output

Oh My Zsh Colourize Plugin

This plugin uses CCZE to colourize some commands output.

Installation:

Copy ccze.plugin.zsh to ~/.oh-my-zsh/custom/plugins/ccze and logout and login again.

Usage:

colourize COMMAND ARGUMENTS...

The following commands will be automatically colourized:

  • cat
  • configure
  • diff
  • g++
  • gcc
  • ld
  • make
  • netstat
  • ping
  • tail
  • traceroute

Note

If the command cannot be found by command -v, pass argument force after the command to create_alias, like configure:

create_alias configure force
# CCZE Colourize for Oh My Zsh
# Author: Tercio Gaudencio Filho - https://gist.github.com/0x3333
CCZE="$(command -v ccze)"
function colourize {
eval "$@ | $CCZE -A"
}
function create_alias {
CMD="$(command -v $1)"
if [ "force" = "$2" ]; then
CMD="$1"
fi
if [ -n "$CMD" ]; then
alias $1="colourize $CMD"
fi
}
if [ -n "$CCZE" ]; then
alias colourize=colourize
create_alias cat
create_alias configure force
create_alias diff
create_alias g++
create_alias gcc
create_alias ld
create_alias make
create_alias netstat
create_alias ping
create_alias tail
create_alias traceroute
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment