commit 87aeab76b6e0042c0f77ebf4a6a0c00bea1fac71
parent b90807f323e0d304524314f9afcafa6d6e4acc5d
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Thu, 31 Dec 2020 02:05:36 -0800
Add script to cd into a directory from a predefined list
The goto script processes then shows a directory listing via dmenu(1)
and prints the selected directory to the standard output, additionaly
add a shell alias of the same name to call the cd builtin on the
output of the script.
Diffstat:
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/modules/scripts/.local/bin/goto b/modules/scripts/.local/bin/goto
@@ -0,0 +1,5 @@
+#!/usr/local/bin/rc -e
+#! goto -- go to different directories
+
+# TODO: figure out rc(1) eval
+m4 $XDG_CONFIG_HOME/goto | column -ts' ' | dmenu | cut -f1 -d' ' | sed 's!^~!'^$HOME^!
diff --git a/modules/shell/.config/shell/cd b/modules/shell/.config/shell/cd
@@ -21,6 +21,9 @@ cdr() {
cd ${d:?No match}
}
+# chdir to goto script result
+goto() { cd `command goto` ;}
+
# This seems to only be in ksh(1), perhaps put these in kshrc. Note
# that without a trailing slash a space is inserted for <tab>.
alias -d c=$HOME/own/src/c/