1234567891011121314151617181920 |
- var dir-stack = [$pwd]
- fn on-chdir {|_dir|
- var last = $dir-stack[0]
- if (not-eq $pwd $last) {
- set dir-stack = [ $pwd $@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]
|