From 047c71f8b55dec37e9e0393f4e7b4542abb7ae4f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 12 Dec 2015 16:59:07 -0500 Subject: [PATCH] auto-bg/fg with C-z --- zsh/keybinds.zsh | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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)