From b3977e9ebd68f5dd2d20e65a993b2c4464a3f80f Mon Sep 17 00:00:00 2001 From: Riccardo Sven Risuleo Date: Tue, 24 Jun 2014 19:42:26 +0200 Subject: [PATCH] Add tilingaware plugin Add plugin to save the present working directory over different zsh sessions. The last change in directory will be preserved. Add `chpwd' function to change the directory new shells will be opened in. --- plugins/tilingaware/tilingaware.plugin.zsh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 plugins/tilingaware/tilingaware.plugin.zsh diff --git a/plugins/tilingaware/tilingaware.plugin.zsh b/plugins/tilingaware/tilingaware.plugin.zsh new file mode 100644 index 000000000..39c8e50ce --- /dev/null +++ b/plugins/tilingaware/tilingaware.plugin.zsh @@ -0,0 +1,10 @@ +DIRSTACKSIZE=9 +DIRSTACKFILE=~/.zdirs +if [[ -f $DIRSTACKFILE ]] && [[ $#dirstack -eq 0 ]]; then + dirstack=( ${(f)"$(< $DIRSTACKFILE)"} ) + [[ -d $dirstack[1] ]] && cd $dirstack[1] +fi + +function chpwd() { + print -l $PWD ${(u)dirstack}> $DIRSTACKFILE +}