diff --git a/terminal/.config/zsh/zshrc b/terminal/.config/zsh/zshrc index 40561b5..f6392e3 100644 --- a/terminal/.config/zsh/zshrc +++ b/terminal/.config/zsh/zshrc @@ -171,16 +171,17 @@ alias history="fc -l -d -D" ### Glob Alias expansion # Expand aliases inline - see http://blog.patshead.com/2012/11/automatically-expaning-zsh-global-aliases---simplified.html globalias() { - if [[ $LBUFFER =~ [A-Z0-9]+$ ]]; then - zle _expand_alias - zle expand-word - fi - zle self-insert + zle _expand_alias + zle expand-word + zle magic-space } zle -N globalias -bindkey " " globalias -bindkey "^ " magic-space # control-space to bypass completion -bindkey -M isearch " " magic-space # normal space during searches +bindkey -M emacs "^ " globalias # expand anything when hitting +bindkey -M viins "^ " globalias # only expand when in insert mode for vi +bindkey -M emacs " " self-insert +bindkey -M viins " " self-insert +bindkey -M vicmd " " self-insert # space puts a space, even in cmd mode +bindkey -M isearch " " self-insert # normal space during searches # allow inserting previous arguments in the current zle input # see https://stackoverflow.com/a/34861762 @@ -234,8 +235,6 @@ bindkey -M vicmd 'C' _run-cdi # insert-mode keybind is above, using regular fzf sourcing bindkey -M vicmd 'T' fzf-file-widget -# space puts a space, even in cmd mode -bindkey -a ' ' magic-space # always allow backspace/delete to remove letters bindkey '^?' backward-delete-char bindkey -a '^?' backward-delete-char