]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/plugins/globalias/globalias.plugin.zsh
bd27d589d3b28fe45293a3887b17b0b226e28922
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / plugins / globalias / globalias.plugin.zsh
1 globalias() {
2    # Get last word to the left of the cursor:
3    # (z) splits into words using shell parsing
4    # (A) makes it an array even if there's only one element
5    local word=${${(Az)LBUFFER}[-1]}
6    if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$word] -eq 0 ]]; then
7       zle _expand_alias
8       zle expand-word
9    fi
10    zle self-insert
11 }
12 zle -N globalias
13
14 # space expands all aliases, including global
15 bindkey -M emacs " " globalias
16 bindkey -M viins " " globalias
17
18 # control-space to make a normal space
19 bindkey -M emacs "^ " magic-space
20 bindkey -M viins "^ " magic-space
21
22 # normal space during searches
23 bindkey -M isearch " " magic-space