grc.plugin.zsh 578 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Adapted from: https://github.com/garabik/grc/blob/master/grc.zsh
  2. if [[ "$TERM" = dumb ]] || (( ! $+commands[grc] )); then
  3. return
  4. fi
  5. # Supported commands
  6. cmds=(
  7. cc
  8. configure
  9. cvs
  10. df
  11. diff
  12. dig
  13. gcc
  14. gmake
  15. ifconfig
  16. iwconfig
  17. last
  18. ldap
  19. make
  20. mount
  21. mtr
  22. netstat
  23. ping
  24. ping6
  25. ps
  26. traceroute
  27. traceroute6
  28. wdiff
  29. whois
  30. )
  31. # Set alias for supported commands
  32. for cmd in $cmds; do
  33. if (( $+commands[$cmd] )); then
  34. eval "function $cmd {
  35. grc --colour=auto \"${commands[$cmd]}\" \"\$@\"
  36. }"
  37. fi
  38. done
  39. # Clean up variables
  40. unset cmds cmd