aboutsummaryrefslogtreecommitdiff
path: root/config.def.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-06-15 14:14:05 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-06-15 14:14:05 -0700
commitb91dbdd3d076752478ca68a2d7b8c36c2a5a3549 (patch)
treedeb2c478a73933a2e9f14c1d139003379dcf8caf /config.def.h
parent45a08afbbd4e3bc6b8ab3dfa4735a182f559624f (diff)
Added $BBDOTFILES, and updated bindings to use it properly. Removed the
`+select:*` and `+deselect:*` in favor of just using shell commands for those functions.
Diffstat (limited to 'config.def.h')
-rw-r--r--config.def.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/config.def.h b/config.def.h
index a388410..09b23fe 100644
--- a/config.def.h
+++ b/config.def.h
@@ -17,6 +17,7 @@
no files are selected, the full path of the file under the cursor
$BBCURSOR: the full path of the file under the cursor
$BBSELECTED: "1" if any files are selected, otherwise ""
+ $BBDOTFILES: "1" if files beginning with "." are visible in bb, otherwise ""
$BB_DEPTH: the number of `bb` instances deep (in case you want to run a
shell and have that shell print something special in the prompt)
$BBCMD: a file to which `bb` commands can be written (used internally)
@@ -28,7 +29,7 @@
..:[01] Whether to show ".." in each directory
cd:<path> Navigate to <path>
columns:<columns> Change which columns are visible, and in what order
- deselect:<filename>|* Deselect <filename> or all ("*")
+ deselect:<filename> Deselect <filename>
dotfiles:[01] Whether dotfiles are visible
goto:<filename> Move the cursor to <filename> (changing directory if needed)
interleave:[01] Whether or not directories should be interleaved with files in the display
@@ -38,8 +39,8 @@
quit Quit bb
refresh Refresh the file listing
scroll:<num*> Scroll the view a numeric amount
- select:<filename>|* Select <filename> or all visible files in current directory ("*")
- sort:([+-]method)+ List of sortings (if equal on one, move to the next)
+ select:<filename> Select <filename>
+ sort:([+-]method)+ Set sorting method (+: normal, -: reverse), additional methods act as tiebreaker
spread:<num*> Spread the selection state at the cursor
toggle:<filename> Toggle the selection status of <filename>
@@ -186,10 +187,12 @@ binding_t bindings[] = {
#endif
B("Open")" file/directory"},
{{' ','v','V'}, "+toggle", B("Toggle")" selection"},
- {{KEY_ESC}, "+deselect:*", B("Clear")" selection"},
+ {{KEY_ESC}, "bb +deselect: \"$@\"", B("Clear")" selection"},
{{'e'}, "$EDITOR \"$@\" || "PAUSE, B("Edit")" file in $EDITOR"},
- {{KEY_CTRL_F}, "bb \"+goto:$(find | "PICK("Find: ", "")")\"", B("Search")" for file"},
- {{'/'}, "bb \"+goto:$(ls -A | "PICK("Pick: ", "")")\"", B("Pick")" file"},
+ {{KEY_CTRL_F}, "bb \"+goto:$(if test $BBDOTFILES; then find -mindepth 1; else find -mindepth 1 ! -path '*/.*'; fi "
+ "| "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,
@@ -243,7 +246,9 @@ binding_t bindings[] = {
{{'g', KEY_HOME}, "+move:0", "Go to "B("first")" file"},
{{'G', KEY_END}, "+move:100%n", "Go to "B("last")" file"},
{{KEY_F5, KEY_CTRL_R}, "+refresh", B("Refresh")},
- {{KEY_CTRL_A}, "+select:*", B("Select all")" files in current directory"},
+ {{KEY_CTRL_A}, "if test $BBDOTFILES; then find -mindepth 1 -maxdepth 1 -print0; else find -mindepth 1 -maxdepth 1 ! -path '*/.*' -print0; fi "
+ "| xargs -0 bb +sel:",
+ B("Select all")" files in current directory"},
{{KEY_PGDN}, "+scroll:+100%", B("Page down")},
{{KEY_PGUP}, "+scroll:-100%", B("Page up")},
{{KEY_CTRL_D}, "+scroll:+50%", B("Half page down")},