Last active
November 1, 2017 17:03
-
-
Save akarzim/557e7b36c538b23dc50fee9f92e09960 to your computer and use it in GitHub Desktop.
Expand aliases with CTRL+SPACE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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