Skip to content

Instantly share code, notes, and snippets.

@akarzim
Last active November 1, 2017 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akarzim/557e7b36c538b23dc50fee9f92e09960 to your computer and use it in GitHub Desktop.
Save akarzim/557e7b36c538b23dc50fee9f92e09960 to your computer and use it in GitHub Desktop.
Expand aliases with CTRL+SPACE
#
# Set key binding to extend aliases.
#
# Authors:
# François Vantomme <akarzim@gmail.com>
#
# Return if requirements are not found.
if [[ "$TERM" == 'dumb' ]]; then
return 1
fi
# Allow command line editing in an external editor.
autoload -Uz edit-command-line
zle -N edit-command-line
# Expand Aliases
function globalias {
zle _expand_alias
zle expand-word
zle magic-space
}
zle -N globalias
# control-space expands all aliases, including global
for keymap in 'emacs' 'viins'; do
bindkey -M "$keymap" "^ " globalias
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment