diff --git a/zsh/keybinds.zsh b/zsh/keybinds.zsh index 57973b6a..08881371 100644 --- a/zsh/keybinds.zsh +++ b/zsh/keybinds.zsh @@ -55,6 +55,19 @@ bindkey -M vicmd 'Y' vi-yank-eol bindkey '^[[A' history-substring-search-up bindkey '^[[B' history-substring-search-down +# C-z to background *and* foreground processes +fancy-ctrl-z () { + if [[ $#BUFFER -eq 0 ]]; then + BUFFER="fg" + zle accept-line + else + zle push-input + zle clear-screen + fi +} +zle -N fancy-ctrl-z +bindkey '^Z' fancy-ctrl-z + # Completion bindkey -M viins '^x^f' fasd-complete-f # C-x C-f to do fasd-complete-f (only files) bindkey -M viins '^x^d' fasd-complete-d # C-x C-d to do fasd-complete-d (only directories)