aboutsummaryrefslogtreecommitdiff
path: root/bindings.bb
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-10-27 14:58:23 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-10-27 14:58:23 -0700
commit55d3f0e160b8d621be11c21045d18deec5807f4e (patch)
tree817f14535a6c38c8729a3d68ffbee0d8a331fcb2 /bindings.bb
parentdc6ecc4e7fb185d8ded1e1ca46bed3d6283a13d7 (diff)
Mostly finalized working version of better signal handling, including
allowing for suspended/resuming processes (bb +fg) and cleaner linked list handling code.
Diffstat (limited to 'bindings.bb')
-rw-r--r--bindings.bb28
1 files changed, 17 insertions, 11 deletions
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: " &&