wd-rs  wd-rs

warpdir

waprdir provides shortcuts for cd under the wd alias. This is a cross-shell/cross-platform drop in replacement the zsh plugin by mfaerevaag (that is to say all of your warps are stored in ~/.warprc and are compatible with the original plugin.)

Adding warps

cd ~/some/nested/directory/thats/tedious/to/tab/complete/mydir
wd add mydir
# Successfully added mydir -> ~/some/nested/directory/thats/tedious/to/tab/complete/mydir

# Or let wd use the directory name
cd ~/some/nested/directory/thats/tedious/to/tab/complete/anotherdir
wd add
# Successfully added anotherdir -> ~/some/nested/directory/thats/tedious/to/tab/complete/anotherdir

Warp!

cd ~
wd mydir
pwd
# ~/some/nested/directory/thats/tedious/to/tab/complete/mydir
wd anotherdir
pwd
# ~/some/nested/directory/thats/tedious/to/tab/complete/anotherdir

Removing warps

wd rm mydir
wd rm anotherdir

wd mydir
# ERROR - no warp point named 'mydir'

Also check out wd help for more commands


Installing

Download and put the warpdir binary in your path (e.g. /usr/local/bin/). There is no need to rename this file to wd because the hook will install it as an alias for you.

bash

Add the following to your .bashrc or .bash_profile (OS X)

# Enable warpdir (https://9ox.org/wd-rs/)
WARPDIR=`which warpdir`
if [[ -x $WARPDIR ]]; then
    eval "$(warpdir hook bash)"
fi

To enable it on existing terminals you can type source ~/.bashrc (or .bash_profile).

zsh

Enabling wd for zsh is the same process as bash. Just indicate zsh instead of bash as your argument for the hook command.

Add the following to your .zshrc

# Enable tab completion scripts. This is already done if you're using oh-my-zsh.
autoload -U compinit
compinit

# Enable warpdir (https://9ox.org/wd-rs/)
WARPDIR=`which warpdir`
if [[ -x $WARPDIR ]]; then
    eval "$(warpdir hook zsh)"
fi

To enable it on existing terminals you can type source ~/.zshrc.

Emacs eshell

While wd-rs could support an eval it's probably easier in the long run to just copy the function directly.

(defun eshell/wd (&rest args)
  (let ((o (with-temp-buffer
             (list (apply 'call-process "warpdir" nil (current-buffer) nil args)
                   (buffer-string)))))
    (if (= (car o) 0)
        (eshell/cd (s-trim (nth 1 o)))
      (nth 1 o))))