From c0653063a9e0813033cab16ff73d72023cd2df75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Uruba?= Date: Sun, 20 Dec 2020 19:15:04 +0100 Subject: [PATCH] remember recent path --- zsh/.zshrc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/zsh/.zshrc b/zsh/.zshrc index fae313b..37e7079 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -28,3 +28,13 @@ bindkey "^[[H" beginning-of-line bindkey "^[[4~" end-of-line bindkey "^[[4h" overwrite-mode bindkey "^[[P" delete-char + +# save path on cd (chpwd is a zsh hook) +function chpwd { + pwd > ~/.last_dir +} + +# restore last saved path on launch +if [[ -f ~/.last_dir ]]; then + cd $(cat ~/.last_dir) +fi