Last Updated: February 25, 2016
·
1.021K
· sheerun

Suspend and resume tool with single shortcut

By adding following code to your ~/.zshrc, you can suspend and resume any tool (vim for example) by pressing Ctrl-Z.

fancy-ctrl-z () {
  if [[ $#BUFFER -eq 0 ]]; then
    fg
    zle redisplay
  else
    zle push-input
  fi
}
zle -N fancy-ctrl-z
bindkey '^Z' fancy-ctrl-z