From 9ee603d6dd79b05b94da40c8ee6c6305d4c2f8d0 Mon Sep 17 00:00:00 2001 From: srdusr Date: Tue, 16 May 2023 16:19:48 +0200 Subject: Fixed toggle fg/bg function --- .config/zsh/.zshrc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to '.config/zsh') diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 4564568..15f7d29 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -298,10 +298,17 @@ getstate () { } # use ctrl-z to toggle in and out of bg -if [[ $- == *i* ]]; then - stty susp undef - bind '"\C-z":" fg\015"' -fi +function toggle_fg_bg() { + if [[ $#BUFFER -eq 0 ]]; then + BUFFER="fg" + zle accept-line + else + BUFFER="" + zle clear-screen + fi +} +zle -N toggle_fg_bg +bindkey '^Z' toggle_fg_bg # cd using "up n" as a command up as many directories, example "up 3" up() { -- cgit v1.2.3