Skip to content

Commit

Permalink
Alternate zsh ^Z hack
Browse files Browse the repository at this point in the history
  • Loading branch information
tpope committed Dec 16, 2015
1 parent 562767e commit e68d9ac
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .zshrc
Expand Up @@ -292,13 +292,16 @@ bindkey -M emacs "\ea" change-first-word
bindkey -M emacs "^XD" describe-key-briefly

fg-widget() {
stty icanon echo -inlcr < /dev/tty
stty lnext '^V' quit '^\' susp '^Z' < /dev/tty
zle reset-prompt
if jobs %- >/dev/null 2>&1; then
fg %-
if [[ $#BUFFER -eq 0 ]]; then
if jobs %- >/dev/null 2>&1; then
BUFFER='fg %-'
else
BUFFER='fg'
fi
zle accept-line
else
fg
zle push-input
zle clear-screen
fi
}
zle -N fg-widget
Expand Down

0 comments on commit e68d9ac

Please sign in to comment.