globalias.plugin.zsh 529 Bytes
Newer Older
slavaGanzin's avatar
slavaGanzin committed
1
globalias() {
2
3
4
   # Get last word to the left of the cursor
   local word=${${(A)=LBUFFER}[-1]}
   if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$word] -eq 0 ]]; then
5
6
7
      zle _expand_alias
      zle expand-word
   fi
slavaGanzin's avatar
slavaGanzin committed
8
9
10
   zle self-insert
}
zle -N globalias
slavaGanzin's avatar
slavaGanzin committed
11

slavaGanzin's avatar
slavaGanzin committed
12
# space expands all aliases, including global
slavaGanzin's avatar
slavaGanzin committed
13
14
15
16
17
18
bindkey -M emacs " " globalias
bindkey -M viins " " globalias

# control-space to make a normal space
bindkey -M emacs "^ " magic-space
bindkey -M viins "^ " magic-space
slavaGanzin's avatar
slavaGanzin committed
19
20
21

# normal space during searches
bindkey -M isearch " " magic-space