🔩 An oh-my-zsh
plugin for git clone && cd
under current directory.
Firstly, clone this repository in oh-my-zsh
's plugins directory.
git clone https://github.com/sukkaw/zsh-gitcd.git ~/.oh-my-zsh/custom/plugins/zsh-gitcd
Secondly, activate the plugin in ~/.zshrc
. Enable it by adding zsh-gitcd
to the plugins array.
plugins=(
[plugins
...]
zsh-gitcd
)
Antigen is a zsh plugin manager, and it support oh-my-zsh
plugin as well. You only need to add antigen bundle sukkaw/zsh-gitcd
to your .zshrc
with your other bundle commands if you are using Antigen. Antigen will handle cloning the plugin for you automatically the next time you start zsh. You can also add the plugin to a running zsh with antigen bundle sukkaw/zsh-gitcd
for testing before adding it to your .zshrc
.
Congratulations! Open a new terminal or run source $HOME/.zshrc
.
When target directory doesn't exist:
$ gitcd https://github.com/SukkaW/zsh-gitcd.git
Git cloning https://github.com/SukkaW/zsh-gitcd into zsh-gitcd...
Cloning into 'zsh-gitcd'...
remote: ....
remote: ....
Unpacking objects: .... , done.
You are now at zsh-gitcd.
When target directory already exists:
$ gitcd https://github.com/SukkaW/zsh-gitcd.git
zsh-gitcd already exists.
cd zsh-gitcd / delete zsh-gitcd && git clone [ y(default) / n ]: y
You are now at zsh-gitcd.
$ gitcd https://github.com/SukkaW/zsh-gitcd.git
zsh-gitcd already exists.
cd zsh-gitcd / delete zsh-gitcd && git clone [ y(default) / n ]: n
Deleting zsh-gitcd...
Git cloning https://github.com/SukkaW/zsh-gitcd into zsh-gitcd...
Cloning into 'zsh-gitcd'...
remote: ....
remote: ....
Unpacking objects: .... , done.
You are now at zsh-gitcd.
If you install zsh-gitcd
with Antigen, you need to remove antigen bundle sukkaw/zsh-gitcd
to disable the plugin.
If you install zsh-gitcd
with oh-myzsh, you need to remove zsh-gitcd
item from plugin array, then run rm -rf ~/.oh-my-zsh/custom/plugins/zsh-gitcd
to remove the plugin.
zsh-gitcd © Sukka, Released under the MIT License.
Authored and maintained by Sukka with help from contributors (list).
Personal Website · Blog · GitHub @SukkaW · Telegram Channel @SukkaChannel · Twitter @isukkaw · Keybase @sukka