From 70c58e6e1c587dfc95e474f6facc18fb685b7512 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Fri, 17 Apr 2026 10:53:33 +0100 Subject: feat: add Ctrl-Z toggle for foreground/background MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Single Ctrl-Z press suspends a process AND resumes it — no need to type 'fg' manually. If no jobs are suspended, clears the screen instead. Very ergonomic for editor/build workflows. --- home/.config/zsh/.zshrc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/home/.config/zsh/.zshrc b/home/.config/zsh/.zshrc index 412b628..cd6458e 100644 --- a/home/.config/zsh/.zshrc +++ b/home/.config/zsh/.zshrc @@ -103,6 +103,20 @@ bindkey '^[[1;3D' backward-word # Alt-Left bindkey '^H' backward-kill-word # Ctrl-Backspace bindkey '^[[3;5~' kill-word # Ctrl-Delete +# Ctrl-Z: toggle foreground/background (no need to type 'fg') +toggle-fg-bg() { + if (( ${#jobstates} )); then + zle .push-input + BUFFER="fg" + zle .accept-line + else + zle .push-input + zle .clear-screen + fi +} +zle -N toggle-fg-bg +bindkey '^Z' toggle-fg-bg + # Ctrl-D exits even on non-empty line exit_zsh() { exit } zle -N exit_zsh -- cgit v1.2.3-70-g09d2