zimfw / utility

Utility aliases and functions. Adds colour to ls, grep and less.
MIT License
13 stars 9 forks source link

Use GNU grep if available, on macOS as well #3

Closed kissge closed 2 years ago

kissge commented 2 years ago

Hope zim teams also like this. Or if not, please feel free to just close this PR.

ericbn commented 2 years ago

Thanks for the contribution, @kissge!

ericbn commented 2 years ago

After trying it out I decided to revert the change, because it causes the grep alias to not be created in macOS if ggrep does not exist.

kissge commented 2 years ago

I see.

On my second thought, isn't this all we need?:

  if (( ${+commands[ggrep]} )); then
     alias grep='ggrep --color=auto'
  else
    alias grep='grep --color=auto'
  fi
ericbn commented 2 years ago

The goal of the module is to enable colors and add some extra handy aliases, not replace BSD tools by GNU ones. This can be done separately. E.g. in macOS with homebrew and the grep formula installed, you can add PATH="/usr/local/opt/grep/libexec/gnubin:$PATH" to your .zshrc file.