Set CDPATH for interactive shells
dblume

dblume commited on 2022-05-20 18:01:04
Showing 1 changed files, with 9 additions and 1 deletions.

... ...
@@ -117,8 +117,16 @@ case "$-" in
117 117
   stty -ixon # disable XON/XOFF flow control
118 118
   stty ixoff # enable sending (to app) of start/stop characters
119 119
   stty ixany # let any character restart output, not only start character
120
+
121
+  # set CDPATH
122
+  # Don't use export. Only POSIX needs it to start with ".:"
123
+  # This may get appended to in .localrc
124
+  CDPATH=$HOME
125
+  case :$SHELLOPTS: in
126
+   *:posix:*) CDPATH=.:$CDPATH ;;
127
+  esac
128
+
120 129
  ;;
121
-*) ;;
122 130
 esac
123 131
 
124 132
 alias findinpyfiles="find . -name \*.py -print0 | xargs -0 grep -nI"
125 133