|
@@ -0,0 +1,20 @@
|
|
|
+var dir-stack = [$pwd]
|
|
|
+
|
|
|
+fn on-chdir {|dir|
|
|
|
+ var last = $dir-stack[0]
|
|
|
+ if (not-eq $dir $last) {
|
|
|
+ set dir-stack = [ $dir $@dir-stack ]
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+edit:add-var popd~ {||
|
|
|
+ if (> (count $dir-stack) 1) {
|
|
|
+ set dir-stack = $dir-stack[1..]
|
|
|
+ var last = $dir-stack[0]
|
|
|
+ cd $last
|
|
|
+ } else {
|
|
|
+ edit:notify "Reached bottom of directory stack"
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+set after-chdir = [$on-chdir~ $@after-chdir]
|