zsh-cwd records directory changes in all shells and lets you change to the latest working directory.
As you change directory the path will be stored in a state file (default ~/.cwd). You can use cwd to
change the current working directory to the latest state.
This allows you to open a new terminal at the last known working directory.
To force a directory path to be written to the state you can use rwd. This can be helpful if you have
recently changed directory somewhere but now want to make sure the current working directory is recorded
as the latest working directory.
- Clone this repository into $ZSH_CUSTOM/plugins (by default ~/.oh-my-zsh/custom/plugins)
git clone https://github.com/pjvds/zsh-cwd ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-cwd- Add the plugin to the list of plugin for Oh My Zsh to load (inside
~/.zshrc):
plugins=(zsh-cwd)- Add the
cwdcommand to the end of you~/.zshrcfile:
echo "cwd" >> ~/.zshrcIf you use zlplug as a plugin manager for zsh, all you have to do is to put the following in your .zshrc:
- Add the
zsh-cwdto you zplug configuration (usually inside~/zshrc):
zplug "pjvds/zsh-cwd", hook-load:"cwd"If you use antigen as a plugin manager for zsh, all you have to do is to put the following in your .zshrc:
- Add the
zsh-cwdas a bundle to you antigen configuration (usually inside~/zshrc):
antigen bundle pjvds/zsh-cwd- After your
antigen apply, add thecwdcommand to change your working directory to the latest when opening a new shell:
echo "cmd" >> ~/.zshrc
Otherwise, to install it manually execute the following lines you shell:
git clone https://github.com/pjvds/zsh-cwd ~/.zsh-cwd
echo "source ~/.zsh-cwd/zsh-cwd.plugin.zsh" >> ~/.zshrc
echo "cwd" >> ~/.zshrc