![]() |
4 月之前 | |
---|---|---|
.. | ||
LICENSE | 10 年之前 | |
README.md | 7 月之前 | |
_wd.sh | 11 月之前 | |
wd.plugin.zsh | 7 月之前 | |
wd.sh | 4 月之前 |
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
comes bundled with oh-my-zsh!
Just add the plugin in your .zshrc
file:
plugins=(... wd)
In your .zshrc
:
antigen bundle mfaerevaag/wd
In your .zshrc
:
antibody bundle mfaerevaag/wd
yay -S zsh-plugin-wd-git
# or use any other AUR helper
.zshrc
:wd() {
. /usr/share/wd/wd.sh
}
Add the following to your home.nix
then run home-manager switch
:
programs.zsh.plugins = [
{
name = "wd";
src = pkgs.fetchFromGitHub {
owner = "mfaerevaag";
repo = "wd";
rev = "v0.5.2";
sha256 = "sha256-4yJ1qhqhNULbQmt6Z9G22gURfDLe30uV1ascbzqgdhg=";
};
}
];
zplug "mfaerevaag/wd", as:command, use:"wd.sh", hook-load:"wd() { . $ZPLUG_REPOS/mfaerevaag/wd/wd.sh }"
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
Run either command in your terminal:
curl -L https://github.com/mfaerevaag/wd/raw/master/install.sh | sh
or
wget --no-check-certificate https://github.com/mfaerevaag/wd/raw/master/install.sh -O - | sh
git clone git@github.com:mfaerevaag/wd.git ~/.local/wd --depth 1
wd
function to .zshrc
(or .profile
etc.):wd() {
. ~/.local/wd/wd.sh
}
Move manpage into an appropriate directory, then trigger mandb
to discover it
sudo install -m 644 ~/.local/wd/wd.1 /usr/share/man/man1/wd.1
sudo mandb /usr/share/man/man1
Note: when pulling and updating wd
, you'll need to repeat step 3 should the manpage change
If you're NOT using 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
:
fpath=(~/path/to/wd $fpath)
Also, you may have to force a rebuild of zcompdump
by running:
rm -f ~/.zcompdump; compinit
wd
comes with an fzf
-powered browse feature to fuzzy search through all your warp points. It's available through the wd browse
command. For quick access you can set up an alias or keybind in your .zshrc
:
# ctrl-b to open the fzf browser
bindkey ${FZF_WD_BINDKEY:-'^B'} wd_browse_widget
wd add foo
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.
wd addcd /foo/ bar
wd addcd /foo/
You can omit point name to automatically use the current directory's name instead.
foo
with:wd foo
foo
, with autocompletion:wd foo some/inner/path
wd ..
wd ...
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.
wd rm foo
You can omit point name to use the current directory's name instead.
~/.warprc
by default):wd list
wd ls foo
wd path foo
wd show
wd clean
Use wd clean --force
to not be prompted with confirmation.
wd help
The usage will be printed also if you call wd
with no command
wd
:wd --version
~/.warprc
), which is useful for testing:wd --config ./file <command>
wd --quiet <command>
You can configure wd
with the following environment variables:
WD_CONFIG
Defines the path where warp points get stored. Defaults to $HOME/.warprc
.
wd
comes with a small test suite, run with 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
.
cd ./test
./tests.sh
Following @mfaerevaag stepping away from active maintainership of this repository, the following users now are also maintainers of the repo:
Anyone else contributing is greatly appreciated and will be mentioned in the release notes!
Credit to altschuler for an awesome idea.
Hope you enjoy!