docs
[distro-setup] / brc
diff --git a/brc b/brc
index d54570eff2246ce397daf069d25f5bf11fa92e95..74cbb3ff61006dee5d426a56b550a3570a5e6834 100644 (file)
--- a/brc
+++ b/brc
@@ -301,9 +301,8 @@ mysrc /a/bin/distro-functions/src/package-manager-abstractions
 
 # * functions
 
-### begin FSF section ###
 
-# use for temporary functions
+# temporary functions
 y() {
   m "${@//spring/fall}"
 }
@@ -312,15 +311,19 @@ h() {
 }
 
 
+### begin FSF section ###
+
 # Comments before functions are meant to be good useful
 # documentation. If they fail at that, please improve them or send Ian a
 # note.
 
 ## copy bash completion
-# Usage: ORIGINAL_COMMAND TARGET_COMMAND...
 #
 # It copies how the bash completion works from one command to other
-# commands.
+# commands. Generally just use within a .bashrc.
+#
+# Usage: ORIGINAL_COMMAND TARGET_COMMAND...
+#
 ccomp() {
   local c src
   src=$1
@@ -335,17 +338,21 @@ ccomp() {
   eval $c $*
 }
 
-## directory history tracking and navigation.
+## BEGIN functions to change directory better than cd ##
 #
-# cd becomes a function, also aliased to c. b to go back, f to go
-# forward, cl to list recent directories and choose one.
+# The functions:
 #
-# The finer details you may want to skip:
+# c: acts like cd, but stores directory history: you could alias to cd if you wanted.
+# b: go back
+# f: go forward
+# cl: list recent directories and optionally choose one.
 #
-# We also define bl to print the list of back and forward directories.
+# Finer details you may want to skip:
 #
-# We keep 2 stacks, forward and back. Unlike with a web browser, the
-# forward stack is not erased when going somewhere new.
+# bl: print the list of back and forward directories.
+#
+# We keep 2 stacks of directories, forward and back. Unlike with a web
+# browser, the forward stack is not erased when going somewhere new.
 #
 # Recent directories are stored in ~/.cdirs.
 #
@@ -447,7 +454,7 @@ f() {
   #   printf "%s\n" "${_dir_forward[-1]}"
   # fi
 }
-# cd list
+# cl = cd list
 cl() {
   local i line input start
   local -A buttondirs alines
@@ -477,7 +484,9 @@ cl() {
     alines[$line]=t
     buttondirs[${buttons[i]}]="$line"
     printf "%s %s\n" ${buttons[i]} "$line"
-    if (( i == ${#buttons[@]} - 1 )); then
+    # the LINES bit is for when we have a short terminal, just dont print all
+    # the directories. alternative would be to do something like less the list.
+    if (( i == ${#buttons[@]} - 1 )) || { [[ $LINES ]] && (( i == LINES - 3 )); }; then
       break
     fi
     i=$(( i + 1 ))
@@ -492,7 +501,8 @@ cl() {
     c "${buttondirs[$input]}"
   fi
 }
-# back list
+# bl = back list. lists the back and forward directories. i tend to
+# forget this exists and use cl instead.
 bl() {
   local start i j max
   max=10
@@ -533,6 +543,7 @@ bl() {
     fi
   done
 }
+## END functions to change directory better than cd ##
 
 # pee do. run args as a command with output copied to syslog.
 #
@@ -2787,6 +2798,7 @@ rn() {
 }
 n() {
   dunstify -u critical n
+  _psrun=(dunstctl close-all)
 }
 
 catnew() {