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