my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.4 KiB

3 years ago
  1. # gnu-utils plugin
  2. This plugin binds GNU coreutils to their default names, so that you don't have
  3. to call them using their prefixed name, which starts with `g`. This is useful
  4. in systems which don't have GNU coreutils installed by default, mainly macOS
  5. or FreeBSD, which use BSD coreutils.
  6. To use it, add `gnu-utils` to the plugins array in your zshrc file:
  7. ```zsh
  8. plugins=(... gnu-utils)
  9. ```
  10. The plugin works by changing the path that the command hash points to, so
  11. instead of `ls` pointing to `/bin/ls`, it points to wherever `gls` is
  12. installed.
  13. Since `hash -rf` or `rehash` refreshes the command hashes, it also wraps
  14. `hash` and `rehash` so that the coreutils binding is always done again
  15. after calling these two commands.
  16. Look at the source code of the plugin to see which GNU coreutils are tried
  17. to rebind. Open an issue if there are some missing.
  18. ## Other methods
  19. The plugin also documents two other ways to do this:
  20. 1. Using a function wrapper, such that, for example, there exists a function
  21. named `ls` which calls `gls` instead. Since functions have a higher preference
  22. than commands, this ends up calling the GNU coreutil. It has also a higher
  23. preference over shell builtins (`gecho` is called instead of the builtin `echo`).
  24. 2. Using an alias. This has an even higher preference than functions, but they
  25. could be overridden because of a user setting.
  26. ## Author
  27. - [Sorin Ionescu](https://github.com/sorin-ionescu).