X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=4178304e565ec66d61982ff0fb179d4f70be21d2;hb=744df552df2218541797cff2406144f1d6745f44;hp=f07fb67a153880436a35f3a0d79d7b81c7e8b2aa;hpb=ba50de94fa8728459333e95a5019d1cfbf23dd78;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index f07fb67..4178304 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -912,8 +912,19 @@ zle -N insert-last-typed-word; #k# Insert last typed word bindkey "\em" insert-last-typed-word -#k# Shortcut for \kbd{fg} -bindkey -s '^z' "fg\n" +function grml-zsh-fg() { + if (( ${#jobstates} )); then + zle .push-input + [[ -o hist_ignore_space ]] && BUFFER=' ' || BUFFER='' + BUFFER="${BUFFER}fg" + zle .accept-line + else + zle -M 'No background jobs. Doing nothing.' + fi +} +zle -N grml-zsh-fg +#k# A smart shortcut for \kbd{fg} +bindkey '^z' grml-zsh-fg # run command line as user root via sudo: sudo-command-line() {