Explorar o código

Adds ctrl+z at empty prompt resumes background job

Tom McKenzie %!s(int64=5) %!d(string=hai) anos
pai
achega
a9dcde2767
Modificáronse 1 ficheiros con 13 adicións e 0 borrados
  1. 13 0
      .zshrc.d/ctrl-z-bg.zsh

+ 13 - 0
.zshrc.d/ctrl-z-bg.zsh

@@ -0,0 +1,13 @@
+# https://unix.stackexchange.com/a/223440
+
+fancy-ctrl-z () {
+  if [[ $#BUFFER -eq 0 ]]; then
+    bg
+    zle redisplay
+  else
+    zle push-input
+  fi
+}
+
+zle -N fancy-ctrl-z
+bindkey '^Z' fancy-ctrl-z