Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/viko16/gitcd.plugin.zsh
👷 [oh-my-zsh plugin] git clone and change directory by a single command
https://github.com/viko16/gitcd.plugin.zsh
gitcd oh-my-zsh-plugin zsh
Last synced: about 1 month ago
JSON representation
👷 [oh-my-zsh plugin] git clone and change directory by a single command
- Host: GitHub
- URL: https://github.com/viko16/gitcd.plugin.zsh
- Owner: viko16
- License: mit
- Created: 2018-12-27T11:11:44.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-19T01:31:23.000Z (about 4 years ago)
- Last Synced: 2024-09-28T08:21:05.406Z (about 1 month ago)
- Topics: gitcd, oh-my-zsh-plugin, zsh
- Language: Shell
- Homepage:
- Size: 6.84 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gitcd.plugin.zsh
👷 [oh-my-zsh plugin] git clone and change directory by a single command
## Installation
1. Clone this repository into `$ZSH_CUSTOM/plugins` (by default `~/.oh-my-zsh/custom/plugins`)
```sh
git clone https://github.com/viko16/gitcd.plugin.zsh ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/gitcd
```2. Add the plugin to the list of plugins for Oh My Zsh to load (inside `~/.zshrc`):
```sh
plugins=(gitcd)
```3. Start a new terminal session.
## Usage
```sh
$ gitcd
```Example:
```sh
$ gitcd https://github.com/viko16/gitcd.plugin.zsh.git
# => will git clone and cd to "~/Code/github.com/viko16/gitcd.plugin.zsh"
```If the repository is already cloned to local, it will automatically "[cd](https://en.wikipedia.org/wiki/Cd_(command))" there.
## Config
By default, `gitcd` will git clone under `~/Code//`.
If you want to change base dir, just set Environmental Variable name `GITCD_HOME`.Example:
```sh
$ export GITCD_HOME=~/myworkspace
$ gitcd https://github.com/facebook/react
# => ~/myworkspace/github.com/facebook/react
```To omit the part from the local clone path, set `GITCD_USEHOST` to `false` (the value is not case sensitive).
Example:
```sh
$ export GITCD_HOME=~/myworkspace GITCD_USEHOST=false
$ gitcd https://github.com/facebook/react
# => ~/myworkspace/facebook/react
```## Test
```sh
zsh ./test.zsh
```## Thanks
- https://github.com/goreliu/zshguide
- https://github.com/repo-utils/giturl
- https://github.com/robbyrussell/oh-my-zsh/wiki/Customization## License
[MIT License](https://opensource.org/licenses/MIT) © [viko16](https://github.com/viko16)