Initial commit

Ajeet D'Souza 2020-10-31 02:37:17 +05:30
commit e895b7dca6
10 changed files with 214 additions and 0 deletions

32
Algorithm.md Normal file

@ -0,0 +1,32 @@
<!-- markdownlint-disable MD041 -->
## Matching
zoxide uses a simple, predictable algorithm for resolving queries:
1. All matching is case-insensitive.
- `z foo` matches `/foo` as well as `/FOO`.
2. All terms must be present (including slashes) within the path, in order.
- `z fo ba` matches `/foo/bar`, but not `/bar/foo`.
- `z fo / ba` matches `/foo/bar`, but not `/foobar`.
3. The last component of the last keyword must match the last component of the path.
- `z bar` matches `/foo/bar`, but not `/bar/foo`.
- `z foo/bar` (last component: `bar`) matches `/foo/bar`, but not `/foo/bar/baz`.
4. Matches are returned in descending order of [frecency](#Frecency).
## Frecency
Each directory in zoxide is assigned a _score_, starting with 1 the first time it is accessed. Every subsequent access increases the score by 1. When a query is made, we calculate _frecency_ based on the last time the directory was accessed:
| Last access time | Frecency |
| -------------------- | ----------- |
| Within the last hour | `score * 4` |
| Within the last day | `score * 2` |
| Within the last week | `score / 2` |
| Otherwise | `score / 4` |
## Aging
zoxide uses a parameter called `_ZO_MAXAGE` to limit the number of entries in the database based on usage patterns. If the total score of the directories in the database exceeds this value, we divide each directory's score by a factor _k_ such that the new total score becomes ~90% of `_ZO_MAXAGE`. Thereafter, if the new score of any directory falls below 1, we remove it from the database.
Theoretically, the maximum number of directories in the database is `4 * _ZO_MAXAGE`, although it is lower in practice.

55
Configuration.md Normal file

@ -0,0 +1,55 @@
<!-- markdownlint-disable MD033 MD041 -->
## Flags
When calling `zoxide init`, the following flags can be used:
- `--cmd`
- Changes the prefix of predefined aliases (`z`, `zi`).
- e.g. `--cmd j` would change the aliases to `j` and `ji` respectively.
- `--hook <HOOK>`
- Changes how often zoxide increments a directory's score:
| Hook | Description |
| -------- | --------------------------------- |
| `none` | Never |
| `prompt` | At every shell prompt |
| `pwd` | Whenever the directory is changed |
- `--no-aliases`
- Don't define extra aliases (`z`, `zi`).
- These functions will still be available in your shell as `__zoxide_z` and
`__zoxide_zi`, should you choose to redefine them.
## Environment variables
Be sure to set environment variables before calling `zoxide init`.
- `_ZO_DATA_DIR`
- Specifies the directory in which zoxide should store its database.
- The default value varies across OSes:
| OS | Path | Example |
| ----------- | ---------------------------------------- | ------------------------------------------ |
| Linux / BSD | `$XDG_DATA_HOME` or `$HOME/.local/share` | `/home/alice/.local/share` |
| macOS | `$HOME/Library/Application Support` | `/Users/Alice/Library/Application Support` |
| Windows | `{FOLDERID_RoamingAppData}` | `C:\Users\Alice\AppData\Roaming` |
- `_ZO_ECHO`
- When set to `1`, `z` will print the matched directory before navigating to
it.
- `_ZO_EXCLUDE_DIRS`
- Excludes the specified directories from the database.
- This is provided as a list of [globs](https://man7.org/linux/man-pages/man7/glob.7.html), separated by OS-specific
characters:
| OS | Separator | Example |
| ------------------- | --------- | ----------------------- |
| Linux / macOS / BSD | `:` | `$HOME:$HOME/private/*` |
| Windows | `;` | `$HOME;$HOME/private/*` |
- By default, this is set to `"$HOME"`.
- `_ZO_FZF_OPTS`
- Custom options to pass to [`fzf`](https://github.com/junegunn/fzf). See `man fzf` for the list of
options.
- `_ZO_MAXAGE`
- Configures the [aging algorithm](Algorithm#aging), which limits the maximum
number of entries in the database.
- By default, this is set to `10000`.
- `_ZO_RESOLVE_SYMLINKS`
- When set to `1`, `z` will resolve symlinks before adding directories to the
database.

1
Home.md Normal file

@ -0,0 +1 @@
Welcome to the zoxide wiki!

@ -0,0 +1,9 @@
<!-- markdownlint-disable MD041 -->
To install zoxide on Android, use a package manager:
| Repository | Instructions |
| ---------- | -------------------- |
| [Termux] | `pkg install zoxide` |
[termux]: https://github.com/termux/termux-packages/tree/master/packages/zoxide

15
Installation-(BSD).md Normal file

@ -0,0 +1,15 @@
<!-- markdownlint-disable MD041 -->
To install zoxide on BSD, use a package manager:
| Distribution | Repository | Instructions |
| ------------- | --------------- | ---------------------- |
| ***Any*** | **[crates.io]** | `cargo install zoxide` |
| DragonFly BSD | [DPorts] | `pkg install zoxide` |
| FreeBSD | [FreshPorts] | `pkg install zoxide` |
| NetBSD | [pkgsrc] | `pkgin install zoxide` |
[crates.io]: https://crates.io/crates/zoxide
[dports]: https://github.com/DragonFlyBSD/DPorts/tree/master/sysutils/zoxide
[freshports]: https://www.freshports.org/sysutils/zoxide/
[pkgsrc]: https://pkgsrc.se/sysutils/zoxide

40
Installation-(Linux).md Normal file

@ -0,0 +1,40 @@
<!-- markdownlint-disable MD033 MD041 -->
To install zoxide on Linux, run this in a terminal:
```sh
curl -sS https://webinstall.dev/zoxide | bash
```
Alternatively, you can use a package manager:
| Distribution | Repository | Instructions |
| ------------------ | ----------------------- | ---------------------------------------------------------------------------------------------- |
| ***Any*** | **[crates.io]** | `cargo install zoxide` |
| *Any* | [conda-forge] | `conda install -c conda-forge zoxide` |
| *Any* | [Linuxbrew] | `brew install zoxide` |
| Alpine Linux 3.13+ | [Alpine Linux Packages] | `apk add zoxide` |
| Arch Linux | [AUR] | `yay -Sy zoxide-bin` |
| CentOS 7+ | [Copr] | `dnf copr enable atim/zoxide` <br /> `dnf install zoxide` |
| Debian Testing | [Debian Packages] | `apt install zoxide` |
| Devuan 4.0+ | [Devuan Packages] | `apt install zoxide` |
| Fedora 32+ | [Fedora Packages] | `dnf install zoxide` |
| Gentoo | [GURU Overlay] | `eselect repository enable guru` <br /> `emerge --sync guru` <br /> `emerge app-shells/zoxide` |
| NixOS | [nixpkgs] | `nix-env -iA nixpkgs.zoxide` |
| Parrot OS | | `apt install zoxide` |
| Ubuntu 21.04+ | [Ubuntu Packages] | `apt install zoxide` |
| Void Linux | [Void Linux Packages] | `xbps-install -S zoxide` |
[alpine linux packages]: https://pkgs.alpinelinux.org/packages?name=zoxide
[aur]: https://aur.archlinux.org/packages/zoxide-bin
[conda-forge]: https://anaconda.org/conda-forge/zoxide
[copr]: https://copr.fedorainfracloud.org/coprs/atim/zoxide/
[crates.io]: https://crates.io/crates/zoxide
[debian packages]: https://packages.debian.org/testing/admin/zoxide
[devuan packages]: https://pkginfo.devuan.org/cgi-bin/package-query.html?c=package&q=zoxide
[fedora packages]: https://src.fedoraproject.org/rpms/rust-zoxide
[guru overlay]: https://github.com/gentoo-mirror/guru
[linuxbrew]: https://formulae.brew.sh/formula-linux/zoxide
[nixpkgs]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/zoxide/default.nix
[ubuntu packages]: https://packages.ubuntu.com/hirsute/zoxide
[void linux packages]: https://github.com/void-linux/void-packages/tree/master/srcpkgs/zoxide

21
Installation-(Windows).md Normal file

@ -0,0 +1,21 @@
<!-- markdownlint-disable MD041 -->
To install zoxide on Windows, run this in a command prompt:
```sh
curl.exe -A "MS" https://webinstall.dev/zoxide | powershell
```
Alternatively, you can use a package manager:
| Repository | Instructions |
| --------------- | ------------------------------------- |
| **[crates.io]** | `cargo install zoxide` |
| [Chocolatey] | `choco install zoxide` |
| [conda-forge] | `conda install -c conda-forge zoxide` |
| [Scoop] | `scoop install zoxide` |
[chocolatey]: https://community.chocolatey.org/packages/zoxide
[conda-forge]: https://anaconda.org/conda-forge/zoxide
[crates.io]: https://crates.io/crates/zoxide
[scoop]: https://github.com/ScoopInstaller/Main/tree/master/bucket/zoxide.json

21
Installation-(macOS).md Normal file

@ -0,0 +1,21 @@
<!-- markdownlint-disable MD041 -->
To install zoxide on macOS, run this in a terminal:
```sh
curl -sS https://webinstall.dev/zoxide | bash
```
Alternatively, you can use a package manager:
| Repository | Instructions |
| --------------- | ------------------------------------- |
| **[crates.io]** | `cargo install zoxide` |
| [conda-forge] | `conda install -c conda-forge zoxide` |
| [Homebrew] | `brew install zoxide` |
| [MacPorts] | `port install zoxide` |
[conda-forge]: https://anaconda.org/conda-forge/zoxide
[crates.io]: https://crates.io/crates/zoxide
[homebrew]: https://formulae.brew.sh/formula/zoxide
[macports]: https://ports.macports.org/port/zoxide/summary

10
Installation.md Normal file

@ -0,0 +1,10 @@
<!-- markdownlint-disable MD041 -->
zoxide is available on all major platforms. If your platform isn't listed here,
please [open an issue](https://github.com/ajeetdsouza/zoxide/issues/new).
- [Linux](Installation-(Linux))
- [macOS](Installation-(macOS))
- [Windows](Installation-(Windows))
- [BSD](Installation-(BSD))
- [Android](Installation-(Android))

10
_Sidebar.md Normal file

@ -0,0 +1,10 @@
<!-- markdownlint-disable MD041 -->
- [Installation](Installation)
- [Linux](Installation-(Linux))
- [macOS](Installation-(macOS))
- [Windows](Installation-(Windows))
- [BSD](Installation-(BSD))
- [Android](Installation-(Android))
- [Configuration](Configuration)
- [Algorithm](Algorithm)