From 55d3f0e160b8d621be11c21045d18deec5807f4e Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 27 Oct 2019 14:58:23 -0700 Subject: Mostly finalized working version of better signal handling, including allowing for suspended/resuming processes (bb +fg) and cleaner linked list handling code. --- bindings.bb | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'bindings.bb') diff --git a/bindings.bb b/bindings.bb index 132efa0..5a8e2fc 100644 --- a/bindings.bb +++ b/bindings.bb @@ -5,10 +5,12 @@ Section: BB Commands bb +help q,Q: # Quit bb +quit -Ctrl-c: # Exit with failure - bb +kill +Ctrl-c: # Send interrupt signal + kill -INT $PPID Ctrl-z: # Suspend - bb +suspend + kill -TSTP $PPID +Ctrl-\: # Quit and generate core dump + kill -QUIT $PPID Section: File Navigation j,Down: # Next file @@ -139,14 +141,8 @@ Ctrl-n: # New file/directory *) exit ;; esac && bb +goto:"$name" +refresh || pause -p: # Page through a file with $PAGER - $PAGER "$BBCURSOR" -|: # Pipe selected files to a command - ask cmd '|' && printf '%s\n' "$@" | sh -c "$BBSHELLFUNC$cmd"; bb +r; pause -:: # Run a command - ask cmd ':' && sh -c "$BBSHELLFUNC$cmd" -- "$@"; bb +r; pause ->: # Open a shell - tput rmcup; tput cvvis; $SHELL; bb +r +p: # Page through a file with `less` + less -XK "$BBCURSOR" r,F2: # Rename a file ask newname "Rename $(printf "\033[33m%s\033[39m" "$(basename "$BBCURSOR")"): " "$(basename "$BBCURSOR")" || exit r="$(dirname "$BBCURSOR")/$newname" || exit @@ -177,6 +173,16 @@ Ctrl-r: # Regex rename files if [ $# -gt 0 ]; then rename -i "$patt" "$rep" "$@"; else rename -i "$patt" "$rep" *; fi; bb +deselect +refresh +Section: Shell Commands +:: # Run a command + ask cmd ':' && sh -c "$BBSHELLFUNC$cmd" -- "$@"; bb +r; pause +|: # Pipe selected files to a command + ask cmd '|' && printf '%s\n' "$@" | sh -c "$BBSHELLFUNC$cmd"; bb +r; pause +>: # Open a shell + tput rmcup; tput cvvis; $SHELL; bb +r +f: # Resume suspended process + bb +fg + Section: Viewing Options s: # Sort by... ask1 sort "Sort (n)ame (s)ize (m)odification (c)reation (a)ccess (r)andom (p)ermissions: " && -- cgit v1.2.3