Skip to content

Getting Started

Installation

Arch Linux
sh
git clone https://github.com/deorbil-aur/zd-git.git
cd zd-git
makepkg -si
Building from Source

Install the following tools:

Install the following dependencies:

This will clone the repository, build the project, and create an executable in the target/release directory.

sh
git clone https://github.com/deorbil/zd.git
cd zd
cargo build --release --locked

TIP

Move the executable to a directory in your PATH (such as /usr/local/bin or ~/.local/bin):

sh
sudo cp target/release/zd /usr/local/bin/
cp target/release/zd ~/.local/bin/

Setup

Bash

Add the following to your ~/.bashrc:

bash
eval "$(zd init bash)"
Zsh

Add the following to your ~/.zshrc:

zsh
eval "$(zd init zsh)"

Adding Directories

By default, zd will use your default shell as the script interpreter.

Bash

Create a new file ~/.zdrc with the following content to add your first directory:

bash
#!/usr/bin/env bash
echo "$HOME"

TIP

You can add more directories using echo or any other command that outputs directory paths. For example, use find to add multiple directories:

bash
#!/usr/bin/env bash
echo "$HOME"
find "$HOME/source" -maxdepth 1 -type d
Zsh

Create a new file ~/.zdrc with the following content to add your first directory:

zsh
#!/usr/bin/env zsh
echo "$HOME"

TIP

You can add more directories using echo or any other command that outputs directory paths. For example, use find to add multiple directories:

zsh
#!/usr/bin/env zsh
echo "$HOME"
find "$HOME/source" -maxdepth 1 -type d

Alternatively, replace ~/.zdrc with an executable. This can be either a binary or a shebang script.

Binary

Move the binary to ~/.zdrc, then make it executable:

sh
chmod +x ~/.zdrc
Lua

Add the following to your ~/.zdrc:

lua
#!/usr/bin/env lua
print(os.getenv("HOME"))

Make ~/.zdrc executable:

sh
chmod +x ~/.zdrc
Node.js

Add the following to your ~/.zdrc:

js
#!/usr/bin/env node
const os = require("os");
console.log(os.homedir());

Make ~/.zdrc executable:

sh
chmod +x ~/.zdrc
Python

Add the following to your ~/.zdrc:

py
#!/usr/bin/env python3
import os
print(os.path.expanduser("~"))

Make ~/.zdrc executable:

sh
chmod +x ~/.zdrc

Installing a Plugin

Install the zd-cd plugin:

sh
zd plugin add cd https://github.com/deorbil/zd-cd.git

Then reload your shell and run the following command:

sh
z

Released under the MIT License