Fixed some stuff with key bindings spamming stdout
This commit is contained in:
parent
7a757b7906
commit
2f70e8a9ba
23
config.def.h
23
config.def.h
@ -96,7 +96,7 @@ typedef struct {
|
|||||||
#define EXECUTABLE_COLOR "\033[31m"
|
#define EXECUTABLE_COLOR "\033[31m"
|
||||||
|
|
||||||
// Some handy macros for common shell script behaviors:
|
// 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:
|
// Bold text:
|
||||||
#define B(s) "\033[1m" s "\033[22m"
|
#define B(s) "\033[1m" s "\033[22m"
|
||||||
@ -169,6 +169,7 @@ const char *startupcmds[] = {
|
|||||||
* after editing.
|
* after editing.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
binding_t bindings[] = {
|
binding_t bindings[] = {
|
||||||
|
{{'1'}, "echo \"you said: '$(sed 1q </dev/tty)'\" >/dev/tty; "PAUSE, "repeat"},
|
||||||
{{'?', KEY_F1}, "bb -b | $PAGER -rX", B("Help")" menu"},
|
{{'?', KEY_F1}, "bb -b | $PAGER -rX", B("Help")" menu"},
|
||||||
{{'q', 'Q'}, "+quit", B("Quit")},
|
{{'q', 'Q'}, "+quit", B("Quit")},
|
||||||
{{'j', KEY_ARROW_DOWN}, "+move:+1", B("Next")" file"},
|
{{'j', KEY_ARROW_DOWN}, "+move:+1", B("Next")" file"},
|
||||||
@ -178,7 +179,7 @@ binding_t bindings[] = {
|
|||||||
{{'\r', KEY_MOUSE_DOUBLE_LEFT},
|
{{'\r', KEY_MOUSE_DOUBLE_LEFT},
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
"if test -d \"$BBCURSOR\"; then bb \"+cd:$BBCURSOR\"; "
|
"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\"; "
|
"elif file -bI \"$BBCURSOR\" | grep -q '^\\(text/\\|inode/empty\\)'; then $EDITOR \"$BBCURSOR\"; "
|
||||||
"else open \"$BBCURSOR\"; fi",
|
"else open \"$BBCURSOR\"; fi",
|
||||||
#else
|
#else
|
||||||
@ -194,23 +195,23 @@ binding_t bindings[] = {
|
|||||||
"| "PICK("Find: ", "")")\"", B("Search")" for file"},
|
"| "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 "
|
{{'/'}, "bb \"+goto:$(if test $BBDOTFILES; then find -mindepth 1 -maxdepth 1; else find -mindepth 1 -maxdepth 1 ! -path '*/.*'; fi "
|
||||||
"| "PICK("Pick: ", "")")\"", B("Pick")" file"},
|
"| "PICK("Pick: ", "")")\"", B("Pick")" file"},
|
||||||
{{'d', KEY_DELETE}, "rm -rfi \"$@\" && bb '+deselect:*' +r ||" PAUSE, B("Delete")" files"},
|
{{'d', KEY_DELETE}, "rm -rfi \"$@\" >/dev/tty </dev/tty && bb '+deselect:*' +r ||" PAUSE, B("Delete")" files"},
|
||||||
{{'D'}, SPIN("rm -rf \"$@\"")" && bb '+deselect:*' +r ||" PAUSE, B("Delete")" files (without confirmation)"},
|
{{'D'}, SPIN("rm -rf \"$@\"")" >/dev/tty </dev/tty && 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,
|
{{'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"},
|
B("Move")" files to current directory"},
|
||||||
{{'c'}, SPIN("cp -ri \"$@\" .")" && bb +r || "PAUSE, B("Copy")" files to current directory"},
|
{{'c'}, SPIN("cp -ri \"$@\" .")" >/dev/tty </dev/tty && bb +r || "PAUSE, B("Copy")" files to current directory"},
|
||||||
{{'C'}, "for f; do "SPIN("cp \"$f\" \"$f.copy\"")"; done && bb +r || "PAUSE,
|
{{'C'}, "for f; do "SPIN("cp -ri \"$f\" \"$f.copy\"")" >/dev/tty </dev/tty; done && bb +r || "PAUSE,
|
||||||
B("Clone")" files"},
|
B("Clone")" files"},
|
||||||
{{'n'}, ASK("name", "New file: ", "")" && touch \"$name\" && bb \"+goto:$name\" +r || "PAUSE, B("New file")},
|
{{'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")},
|
{{'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"},
|
{{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"},
|
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"},
|
B("Run")" a command"},
|
||||||
{{'>'}, "tput rmcup >/dev/tty; $SHELL; bb +r", "Open a "B("shell")},
|
{{'>'}, "tput rmcup >/dev/tty; $SHELL; bb +r", "Open a "B("shell")},
|
||||||
{{'m'}, "read -n1 -p 'Mark: ' m && bb \"+mark:$m;$PWD\"", "Set "B("mark")},
|
{{'m'}, "read -n1 -p 'Mark: ' m >/dev/tty </dev/tty && bb \"+mark:$m;$PWD\"", "Set "B("mark")},
|
||||||
{{'\''}, "read -n1 -p 'Jump: ' j && bb \"+jump:$j\"", B("Jump")" to mark"},
|
{{'\''}, "read -n1 -p 'Jump: ' j >/dev/tty </dev/tty && bb \"+jump:$j\"", B("Jump")" to mark"},
|
||||||
{{'r'},
|
{{'r'},
|
||||||
"bb +refresh; "
|
"bb +refresh; "
|
||||||
"for f; do "
|
"for f; do "
|
||||||
|
Loading…
Reference in New Issue
Block a user