aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-06-15 16:17:43 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-06-15 16:17:43 -0700
commit2f70e8a9ba91b6185a81a954b62ddd1c2d6e0006 (patch)
tree75640a8fc6f53a47e6dae8b9b421a2cde163a25a
parent7a757b7906d603ab2e1b25ac880c124ed6684ada (diff)
Fixed some stuff with key bindings spamming stdout
-rw-r--r--config.def.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/config.def.h b/config.def.h
index 348377c..c63d596 100644
--- a/config.def.h
+++ b/config.def.h
@@ -96,7 +96,7 @@ typedef struct {
#define EXECUTABLE_COLOR "\033[31m"
// Some handy macros for common shell script behaviors:
-#define PAUSE " read -n1 -p '\033[2mPress any key to continue...\033[0m\033[?25l'"
+#define PAUSE " read -n1 -p '\033[2mPress any key to continue...\033[0m\033[?25l' >/dev/tty </dev/tty"
// Bold text:
#define B(s) "\033[1m" s "\033[22m"
@@ -169,6 +169,7 @@ const char *startupcmds[] = {
* after editing.
*****************************************************************************/
binding_t bindings[] = {
+ {{'1'}, "echo \"you said: '$(sed 1q </dev/tty)'\" >/dev/tty; "PAUSE, "repeat"},
{{'?', KEY_F1}, "bb -b | $PAGER -rX", B("Help")" menu"},
{{'q', 'Q'}, "+quit", B("Quit")},
{{'j', KEY_ARROW_DOWN}, "+move:+1", B("Next")" file"},
@@ -178,7 +179,7 @@ binding_t bindings[] = {
{{'\r', KEY_MOUSE_DOUBLE_LEFT},
#ifdef __APPLE__
"if test -d \"$BBCURSOR\"; then bb \"+cd:$BBCURSOR\"; "
- "elif test -x \"$BBCURSOR\"; then \"$BBCURSOR\"; " PAUSE "; "
+ "elif test -x \"$BBCURSOR\"; then \"$BBCURSOR\" >/dev/tty </dev/tty; " PAUSE "; "
"elif file -bI \"$BBCURSOR\" | grep -q '^\\(text/\\|inode/empty\\)'; then $EDITOR \"$BBCURSOR\"; "
"else open \"$BBCURSOR\"; fi",
#else
@@ -194,23 +195,23 @@ binding_t bindings[] = {
"| "PICK("Find: ", "")")\"", B("Search")" for file"},
{{'/'}, "bb \"+goto:$(if test $BBDOTFILES; then find -mindepth 1 -maxdepth 1; else find -mindepth 1 -maxdepth 1 ! -path '*/.*'; fi "
"| "PICK("Pick: ", "")")\"", B("Pick")" file"},
- {{'d', KEY_DELETE}, "rm -rfi \"$@\" && bb '+deselect:*' +r ||" PAUSE, B("Delete")" files"},
- {{'D'}, SPIN("rm -rf \"$@\"")" && bb '+deselect:*' +r ||" PAUSE, B("Delete")" files (without confirmation)"},
- {{'M'}, SPIN("mv -i \"$@\" . && bb '+deselect:*' +r && for f; do bb \"+sel:$(basename \"$f\")\"; done")" || "PAUSE,
+ {{'d', KEY_DELETE}, "rm -rfi \"$@\" >/dev/tty </dev/tty && bb '+deselect:*' +r ||" PAUSE, B("Delete")" files"},
+ {{'D'}, SPIN("rm -rf \"$@\"")" >/dev/tty </dev/tty && bb '+deselect:*' +r ||" PAUSE, B("Delete")" files (without confirmation)"},
+ {{'M'}, SPIN("mv -i \"$@\" . >/dev/tty </dev/tty && bb '+deselect:*' +r && for f; do bb \"+sel:$(basename \"$f\")\"; done")" || "PAUSE,
B("Move")" files to current directory"},
- {{'c'}, SPIN("cp -ri \"$@\" .")" && bb +r || "PAUSE, B("Copy")" files to current directory"},
- {{'C'}, "for f; do "SPIN("cp \"$f\" \"$f.copy\"")"; done && bb +r || "PAUSE,
+ {{'c'}, SPIN("cp -ri \"$@\" .")" >/dev/tty </dev/tty && bb +r || "PAUSE, B("Copy")" files to current directory"},
+ {{'C'}, "for f; do "SPIN("cp -ri \"$f\" \"$f.copy\"")" >/dev/tty </dev/tty; done && bb +r || "PAUSE,
B("Clone")" files"},
{{'n'}, ASK("name", "New file: ", "")" && touch \"$name\" && bb \"+goto:$name\" +r || "PAUSE, B("New file")},
{{'N'}, ASK("name", "New dir: ", "")" && mkdir \"$name\" && bb \"+goto:$name\" +r || "PAUSE, B("New directory")},
{{KEY_CTRL_G}, "bb \"+cd:$(" ASKECHO("Go to directory: ", "") ")\"", B("Go to")" directory"},
- {{'|'}, ASK("cmd", "|", "") " && printf '%s\\n' \"$@\" | sh -c \"$cmd\"; " PAUSE "; bb +r",
+ {{'|'}, ASK("cmd", "|", "") " && printf '%s\\n' \"$@\" | sh -c \"$cmd\" >/dev/tty; " PAUSE "; bb +r",
B("Pipe")" selected files to a command"},
- {{':'}, "sh -c \"$(" ASKECHO(":", "") ")\" -- \"$@\"; " PAUSE "; bb +refresh",
+ {{':'}, "sh -c \"$(" ASKECHO(":", "") ")\" -- \"$@\" >/dev/tty </dev/tty; " PAUSE "; bb +refresh",
B("Run")" a command"},
{{'>'}, "tput rmcup >/dev/tty; $SHELL; bb +r", "Open a "B("shell")},
- {{'m'}, "read -n1 -p 'Mark: ' m && bb \"+mark:$m;$PWD\"", "Set "B("mark")},
- {{'\''}, "read -n1 -p 'Jump: ' j && bb \"+jump:$j\"", B("Jump")" to mark"},
+ {{'m'}, "read -n1 -p 'Mark: ' m >/dev/tty </dev/tty && bb \"+mark:$m;$PWD\"", "Set "B("mark")},
+ {{'\''}, "read -n1 -p 'Jump: ' j >/dev/tty </dev/tty && bb \"+jump:$j\"", B("Jump")" to mark"},
{{'r'},
"bb +refresh; "
"for f; do "