aboutsummaryrefslogtreecommitdiff
path: root/config.def.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-09-12 18:41:15 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-09-12 18:41:15 -0700
commite1e34bc6ed9aba0d9e88b376007dfe47c9c7a5e4 (patch)
treedac01b0aed3a778d23e95bed106af81cb99d2529 /config.def.h
parent88514eda095f8727036a21758c04f23526efac06 (diff)
Replaced marks system with something a little more elegant using
symbolic links in ~/.config/bb/marks/. The new version is a little more flexible (arbitrary mark names), persistent across bb sessions, and uses a bit less code.
Diffstat (limited to 'config.def.h')
-rw-r--r--config.def.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/config.def.h b/config.def.h
index 4b035c9..167869a 100644
--- a/config.def.h
+++ b/config.def.h
@@ -34,8 +34,6 @@
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
- jump:<key> Jump to the mark associated with <key>
- mark:<key>[=<path>] Associate <key> with <path> (or current dir, if blank)
move:<num*> Move the cursor a numeric amount
quit Quit bb
refresh Refresh the file listing
@@ -149,8 +147,11 @@ const column_t columns[128] = {
// This is a list of commands that runs when `bb` launches:
const char *startupcmds[] = {
// Set some default marks:
- "+mark:0", "+mark:~=~", "+mark:h=~", "+mark:/=/", "+mark:c=~/.config",
- "+mark:l=~/.local", "+mark:s=<selection>",
+ "mkdir -p ~/.config/bb/marks",
+ "ln -sfT ~ ~/.config/bb/marks/home",
+ "ln -sfT / ~/.config/bb/marks/root",
+ "ln -sfT ~/.config ~/.config/bb/marks/config",
+ "ln -sfT ~/.local ~/.config/bb/marks/local",
// Default column and sorting options:
"+sort:+n", "+col:*smpn", "+..",
NULL, // NULL-terminated array
@@ -207,8 +208,12 @@ binding_t bindings[] = {
{{':'}, "sh -c \"$(" ASKECHO(":", "") ")\" -- \"$@\"; " 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"},
+ {{'\''}, "bb +cd:\"$(readlink -f ~/.config/bb/marks/\"$(ls ~/.config/bb/marks | " PICK("Jump to: ", "") ")\")\"",
+ B("Jump")" to a directory"},
+ {{'-'}, "test $BBPREVPATH && bb +cd:\"$BBPREVPATH\"", "Go to "B("previous")" directory"},
+ {{';'}, "bb +cd:'<selection>'", "Go to "B("previous")" directory"},
+ {{'0'}, "bb +cd:\"$BBINITIALPATH\"", "Go to "B("initial")" directory"},
+ {{'m'}, "ln -s \"$PWD\" ~/.config/bb/marks/\"$("ASKECHO("Mark: ", "")")\"", B("Mark")" this directory"},
{{'r'},
"bb +refresh; "
"for f; do "