`wd` (*warp directory*) lets you jump to custom directories in zsh, without using `cd`. Why? Because `cd` seems inefficient when the folder is frequently visited or has a long path.
`wd` (*warp directory*) lets you jump to custom directories in zsh, without using `cd`.
Why?
Because `cd` seems inefficient when the folder is frequently visited or has a long path.
*NEWS*: If you are not using zsh, check out the c-port, [wd-c](https://github.com/mfaerevaag/wd-c), which works with all shells using wrapper functions.
_Note: automatic install does not provide the manpage. It is also poor security practice to run remote code without first reviewing it, so you ought to look [here](https://github.com/mfaerevaag/wd/blob/master/install.sh)_
Run either command in your terminal:
```zsh
```zsh
curl -L https://github.com/mfaerevaag/wd/raw/master/install.sh | sh
curl -L https://github.com/mfaerevaag/wd/raw/master/install.sh | sh
2. Add `wd` function to `.zshrc` (or `.profile` etc.):
wd(){
. ~/path/to/cloned/repo/wd/wd.sh
}
```
* Install manpage. From `wd`'s base directory (requires root permissions):
```zsh
wd(){
. ~/.local/wd/wd.sh
}
```
```zsh
3. Install manpage (optional):
cp wd.1 /usr/share/man/man1/wd.1
chmod 644 /usr/share/man/man1/wd.1
```
**Note:** when pulling and updating `wd`, you'll need to do this again in case of changes to the manpage.
```zsh
sudo cp ~/.local/wd/wd.1 /usr/share/man/man1/wd.1
sudo chmod 644 /usr/share/man/man1/wd.1
```
**Note:** when pulling and updating `wd`, you'll need to repeat step 3 should the manpage change
## Completion
## Completion
If you're NOT using [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) and you want to utilize the zsh-completion feature, you will also need to add the path to your `wd` installation (`~/bin/wd` if you used the automatic installer) to your `fpath`. E.g. in your `~/.zshrc`:
If you're NOT using [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) and you want to utilize the zsh-completion feature, you will also need to add the path to your `wd` installation (`~/bin/wd` if you used the automatic installer) to your `fpath`.
If a warp point with the same name exists, use `wd add! foo` to overwrite it.
If a warp point with the same name exists, use `wd add foo --force` to overwrite it.
**Note:** a warp point cannot contain colons, or consist of only spaces and dots. The first will conflict in how `wd` stores the warp points, and the second will conflict with other features, as below.
**Note:** a warp point cannot contain colons, or consist of only spaces and dots.
The first will conflict in how `wd` stores the warp points, and the second will conflict with other features, as below.
You can omit point name to automatically use the current directory's name instead.
You can omit point name to automatically use the current directory's name instead.
* From any directory, warp to `foo` with:
* From any directory, warp to `foo` with:
```zsh
```zsh
wd foo
wd foo
```
```
* You can also warp to a directory within foo, with autocompletion:
* You can also warp to a directory within `foo`, with autocompletion:
```zsh
```zsh
wd foo some/inner/path
wd foo some/inner/path
```
```
* You can warp back to previous directory and higher, with this dot syntax:
* You can warp back to previous directory and higher, with this dot syntax:
```zsh
```zsh
wd ..
wd ..
wd ...
wd ...
```
```
This is a wrapper for the zsh's `dirs` function.
This is a wrapper for the zsh's `dirs` function.
_You might need to add `setopt AUTO_PUSHD` to your `.zshrc` if you are not using [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh))._
_You might need to add `setopt AUTO_PUSHD` to your `.zshrc` if you are not using [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh)._
* Remove warp point:
* Remove warp point:
```zsh
```zsh
wd rm foo
wd rm foo
```
```
You can omit point name to use the current directory's name instead.
You can omit point name to use the current directory's name instead.
* List all warp points (stored in `~/.warprc`):
* List all warp points (stored in `~/.warprc` by default):
```zsh
```zsh
wd list
wd list
```
```
* List files in given warp point:
* List files in given warp point:
```zsh
```zsh
wd ls foo
wd ls foo
```
```
* Show path of given warp point:
* Show path of given warp point:
```zsh
```zsh
wd path foo
wd path foo
```
```
* List warp points to current directory, or optionally, path to given warp point:
* List warp points to current directory, or optionally, path to given warp point:
```zsh
```zsh
wd show
wd show
```
```
* Remove warp points to non-existent directories.
* Remove warp points to non-existent directories.
```zsh
```zsh
wd clean
wd clean
```
```
Use `wd clean!` to not be prompted with confirmation (force).
Use `wd clean --force` to not be prompted with confirmation.
* Print usage info:
* Print usage info:
```zsh
```zsh
wd help
wd help
```
```
The usage will be printed also if you call `wd` with no command
The usage will be printed also if you call `wd` with no command
* Print the running version of `wd`:
* Print the running version of `wd`:
```zsh
```zsh
wd --version
wd --version
```
```
* Specifically set the config file (default being `~/.warprc`), which is useful for testing:
* Specifically set the config file (default being `~/.warprc`), which is useful for testing:
```zsh
```zsh
wd --config ./file <command>
wd --config ./file <command>
```
```
* Force `exit` with return code after running. This is not default, as it will *exit your terminal*, though required for testing/debugging.
* Force `exit` with return code after running. This is not default, as it will *exit your terminal*, though required for testing/debugging.
```zsh
```zsh
wd --debug <command>
wd --debug <command>
```
```
* Silence all output:
* Silence all output:
```zsh
```zsh
wd --quiet <command>
wd --quiet <command>
```
```
## Configuration
## Configuration
...
@@ -216,7 +234,7 @@ Defines the path where warp points get stored. Defaults to `$HOME/.warprc`.
...
@@ -216,7 +234,7 @@ Defines the path where warp points get stored. Defaults to `$HOME/.warprc`.
## Testing
## Testing
`wd` comes with a small test suite, run with [shunit2](https://code.google.com/p/shunit2/). This can be used to confirm that things are working as they should on your setup, or to demonstrate an issue.
`wd` comes with a small test suite, run with [shunit2](https://github.com/kward/shunit2). This can be used to confirm that things are working as they should on your setup, or to demonstrate an issue.
To run, simply `cd` into the `test` directory and run the `tests.sh`.
To run, simply `cd` into the `test` directory and run the `tests.sh`.
...
@@ -225,15 +243,17 @@ cd ./test
...
@@ -225,15 +243,17 @@ cd ./test
./tests.sh
./tests.sh
```
```
## License
## Maintainers
Following @mfaerevaag stepping away from active maintainership of this repository, the following users now are also maintainers of the repo:
The project is licensed under the [MIT license](https://github.com/mfaerevaag/wd/blob/master/LICENSE).
* @alpha-tango-kilo
## Contributing
* @MattLewin
If you have issues, feedback or improvements, don't hesitate to report it or submit a pull request. In the case of an issue, we would much appreciate if you would include a failing test in `test/tests.sh`. For an explanation on how to run the tests, read the section "Testing" in this README.
Anyone else contributing is greatly appreciated and will be mentioned in the release notes!
----
---
Credit to [altschuler](https://github.com/altschuler) for an awesome idea.
Credit to [altschuler](https://github.com/altschuler) for an awesome idea.