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.

79 lines
1.4 KiB

3 years ago
  1. # Globalias plugin
  2. Expands all glob expressions, subcommands and aliases (including global).
  3. Idea from: https://blog.patshead.com/2012/11/automatically-expaning-zsh-global-aliases---simplified.html.
  4. ## Usage
  5. Add `globalias` to the plugins array in your zshrc file:
  6. ```zsh
  7. plugins=(... globalias)
  8. ```
  9. Then just press `SPACE` to trigger the expansion of a command you've written.
  10. If you only want to insert a space without expanding the command line, press
  11. `CTRL`+`SPACE`.
  12. if you would like to filter out any values from expanding set `GLOBALIAS_FILTER_VALUES` to
  13. an array of said values. See [Filtered values](#filtered-values).
  14. ## Examples
  15. #### Glob expressions
  16. ```
  17. $ touch {1..10}<space>
  18. # expands to
  19. $ touch 1 2 3 4 5 6 7 8 9 10
  20. $ ls **/*.json<space>
  21. # expands to
  22. $ ls folder/file.json anotherfolder/another.json
  23. ```
  24. #### Subcommands
  25. ```
  26. $ mkdir "`date -R`"
  27. # expands to
  28. $ mkdir Tue,\ 04\ Oct\ 2016\ 13:54:03\ +0300
  29. ```
  30. #### Aliases
  31. ```
  32. # .zshrc:
  33. alias -g G="| grep --color=auto -P"
  34. alias l='ls --color=auto -lah'
  35. $ l<space>G<space>
  36. # expands to
  37. $ ls --color=auto -lah | grep --color=auto -P
  38. ```
  39. ```
  40. # .zsrc:
  41. alias S="sudo systemctl"
  42. $ S<space>
  43. # expands to:
  44. $ sudo systemctl
  45. ```
  46. #### Filtered values
  47. ```
  48. # .zshrc
  49. alias l='ls -lh'
  50. alias la='ls --color=auto -lah'
  51. GLOBALIAS_FILTER_VALUES=(l)
  52. $ l<space>
  53. # does not expand
  54. $ la<space>
  55. # expands to:
  56. $ ls --color=auto -lah
  57. ```