bunch of new stuff, a few fixes
[distro-setup] / brc
diff --git a/brc b/brc
index 048fa5131688e744e27f66aa2c463a746fefa548..4274d6e968ea3523e8fbb2569abf78bb9eabc8e2 100644 (file)
--- a/brc
+++ b/brc
@@ -242,6 +242,24 @@ export SL_FILES_DIR=/b/ds/sl/.iank
 export SL_INFO_DIR=/p/sshinfo
 
 
+### begin pyenv ###
+
+# this is adapted from things printed to term after install
+# pyenv. commented for now since I'm not actually using pyenv.
+
+# export PYENV_ROOT="$HOME/.pyenv"
+# command -v pyenv &>/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
+# command -v pyenv &>/dev/null && eval "$(pyenv init -)"
+
+
+# output showed this example for pyenv-virtualenv, which i have no idea
+# what it is, but leaving it as a comment in case I end up doing python
+# dev.
+
+#eval "$(pyenv virtualenv-init -)"
+### end begin pyenv ###
+
+
 
 # * include files
 
@@ -798,12 +816,17 @@ cf() {
   done
 }
 caf() {
-  # shellcheck disable=SC2033
-  find -L "$@" -type f -not \( -name .svn -prune -o -name .git -prune \
-       -o -name .hg -prune -o -name .editor-backups -prune \
-       -o -name .undo-tree-history -prune \) \
-       -exec bash -c '. ~/.bashrc; hr; echo "$1"; hr; cat "$1"' _ {} \; 2>/dev/null
 
+  local file
+find -L "$@" -type f -not \( -name .svn -prune -o -name .git -prune \
+       -o -name .hg -prune -o -name .editor-backups -prune \
+       -o -name .undo-tree-history -prune \) -printf '%h\0%d\0%p\n' | sort -t '\0' -n \
+  | awk -F '\0' '{print $3}' 2>/dev/null | while read -r file; do
+    hr
+    printf "%s\n" "$file"
+    hr
+    cat "$file"
+done
 }
 ccomp cat cf caf
 
@@ -815,6 +838,10 @@ clc() {
   echo "scale=3; $x" | bc -l
 }
 
+cx() {
+  chmod +X "$@"
+  }
+
 cam() {
   git commit -am "$*"
 }
@@ -1363,9 +1390,6 @@ and works in older versions of git which did not have that."
 
 g() {
 
-  # todo: patch emacs so it will look elsewhere. this is kinda sad:
-  # https://emacs.stackexchange.com/questions/4253/how-to-start-emacs-with-a-custom-user-emacs-directory
-
   local args gdb=false
 
   if [[ $EMACSDIR ]]; then
@@ -1388,6 +1412,10 @@ g() {
     fi
   fi
   if [[ $EMACSDIR ]]; then
+
+    # todo: we don't have to alter HOME since emacs 29+, we can set
+    # user-emacs-directory with the flag --init-directory
+
     # Alter the path here, otherwise the nfs mount gets triggered on the
     # first path lookup when emacs is not being used.
     # shellcheck disable=SC2098 disable=SC2097 # false positive
@@ -2760,6 +2788,7 @@ vim() {
 # ls count. usage: pass a directory, get the number of files.
 # https://unix.stackexchange.com/questions/90106/whats-the-most-resource-efficient-way-to-count-how-many-files-are-in-a-director
 lsc() {
+  # shellcheck disable=SC2790 # intentional
   ls -Uq "$@"|wc -l
 }
 
@@ -2792,6 +2821,14 @@ cm() {
 
 
 if $use_color && type -p tput &>/dev/null; then
+  # this is nice for a dark background terminal:
+  # https://github.com/trapd00r/LS_COLORS
+  # I would like if there was something similar for light.
+
+  # the default bold green is too light.
+  # this explains the codes: https://gist.github.com/thomd/7667642
+  export LS_COLORS=ex=1
+
   term_bold="$(tput bold)"
   term_red="$(tput setaf 1)"
   term_green="$(tput setaf 2)"
@@ -2885,7 +2922,7 @@ if [[ $- == *i* ]]; then
     # we happen to be using that terminal, we can just keep working by
     # entering our next command, even a noop in order to dismiss the
     # notification, instead of having to explicitly dismiss it.
-    if [[ ${_psrun[@]} ]]; then
+    if [[ ${_psrun[*]} ]]; then
       if (( _psrun_count >= 1 )); then
 
         "${_psrun[@]}" ||: