diff --git a/CHANGELOG.md b/CHANGELOG.md index 1589ce6..d7224e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fish: error erasing completions on older versions. +- PowerShell: enable `--cmd cd` to replace the `cd` command. ## [0.7.7] - 2021-10-21 diff --git a/README.md b/README.md index 2fcf469..b4afc8f 100644 --- a/README.md +++ b/README.md @@ -6,17 +6,15 @@ "MD033": false } --> -# `zoxide` - -> A smarter cd command for your terminal +# zoxide [![crates.io][crates.io-badge]][crates.io] [![Downloads][downloads-badge]][releases] [![Built with Nix][builtwithnix-badge]][builtwithnix] -`zoxide` is a blazing fast replacement for your `cd` command, inspired by -`z` and `autojump`. It keeps track of the directories you use most -frequently, and uses a ranking algorithm to navigate to the best match. +zoxide is a smarter cd command, inspired by z and autojump. It keeps track of +the directories you use most frequently, and uses a ranking algorithm to +navigate to the best match. ![Tutorial][tutorial] @@ -38,15 +36,15 @@ Read more about the matching algorithm [here][algorithm-matching]. ## Getting started -### *Step 1: Install `zoxide`* +### *Step 1: Install zoxide* -`zoxide` runs on most major platforms. If your platform isn't listed below, +zoxide runs on most major platforms. If your platform isn't listed below, please [open an issue][issues].
Linux -To install `zoxide`, run this command in your terminal: +To install zoxide, run this command in your terminal: ```sh curl -sS https://webinstall.dev/zoxide | bash @@ -78,7 +76,7 @@ Alternatively, you can use a package manager:
macOS -To install `zoxide`, use a package manager: +To install zoxide, use a package manager: | Repository | Instructions | | --------------- | ------------------------------------- | @@ -92,7 +90,7 @@ To install `zoxide`, use a package manager:
Windows -To install `zoxide`, run this command in your command prompt: +To install zoxide, run this command in your command prompt: ```sh curl.exe -A "MS" https://webinstall.dev/zoxide | powershell @@ -112,7 +110,7 @@ Alternatively, you can use a package manager:
BSD -To install `zoxide`, use a package manager: +To install zoxide, use a package manager: | Distribution | Repository | Instructions | | ------------- | --------------- | ------------------------------- | @@ -126,7 +124,7 @@ To install `zoxide`, use a package manager:
Android -To install `zoxide`, use a package manager: +To install zoxide, use a package manager: | Repository | Instructions | | ---------- | -------------------- | @@ -134,12 +132,12 @@ To install `zoxide`, use a package manager:
-### *Step 2: Add `zoxide` to your shell* +### *Step 2: Add zoxide to your shell* -To start using `zoxide`, add it to your shell. +To start using zoxide, add it to your shell.
-bash +bash Add this to your configuration (usually `~/.bashrc`): @@ -150,7 +148,7 @@ eval "$(zoxide init bash)"
-elvish +elvish Add this to your configuration (usually `~/.elvish/rc.elv`): @@ -163,7 +161,7 @@ Note: zoxide only supports elvish v0.16.0 and above.
-fish +fish Add this to your configuration (usually `~/.config/fish/config.fish`): @@ -174,7 +172,7 @@ zoxide init fish | source
-nushell +nushell Add this to your configuration (find it by running `config path` in Nushell): @@ -187,7 +185,7 @@ Note: zoxide only supports Nushell v0.37.0 and above.
-powershell +powershell Add this to your configuration (find it by running `echo $profile` in PowerShell): @@ -202,7 +200,7 @@ Invoke-Expression (& {
-xonsh +xonsh Add this to your configuration (usually `~/.xonshrc`): @@ -213,7 +211,7 @@ execx($(zoxide init xonsh), 'exec', __xonsh__.ctx, filename='zoxide')
-zsh +zsh Add this to your configuration (usually `~/.zshrc`): @@ -234,18 +232,18 @@ eval "$(zoxide init posix --hook prompt)"
-### *Step 3: Install `fzf` (optional)* +### *Step 3: Install fzf (optional)* -[`fzf`][fzf] is a command-line fuzzy finder, used by `zoxide` for interactive +[fzf] is a command-line fuzzy finder, used by zoxide for interactive selection. It can be installed from [here][fzf-installation]. ### *Step 4: Import your data (optional)* If you currently use any of the following utilities, you may want to import -your data into `zoxide`: +your data into zoxide:
-autojump +autojump ```sh zoxide import --from autojump path/to/db @@ -254,7 +252,7 @@ zoxide import --from autojump path/to/db
-z, z.lua, or zsh-z +z, z.lua, or zsh-z ```sh zoxide import --from z path/to/db @@ -270,16 +268,17 @@ When calling `zoxide init`, the following flags are available: - `--cmd` - Changes the prefix of predefined aliases (`z`, `zi`). - - e.g. `--cmd j` would change the aliases to `j` and `ji` respectively. + - `--cmd j` would change the aliases to (`j`, `ji`). + - `--cmd cd` would replace the `cd` command (doesn't work on Nushell / POSIX shells). - `--hook ` - - Changes how often `zoxide` increments a directory's score: + - 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`). + - Don't define aliases (`z`, `zi`). - These functions will still be available in your shell as `__zoxide_z` and `__zoxide_zi`, should you choose to redefine them. @@ -297,7 +296,7 @@ They must be set before `zoxide init` is called. | 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 + - When set to 1, `z` will print the matched directory before navigating to it. - `_ZO_EXCLUDE_DIRS` - Excludes the specified directories from the database. @@ -309,14 +308,14 @@ They must be set before `zoxide init` is called. | Windows | `;` | `$HOME;$HOME/private/*` | - By default, this is set to `"$HOME"`. - `_ZO_FZF_OPTS` - - Custom options to pass to [`fzf`][fzf]. See [`man fzf`][fzf-man] for the list - of options. + - Custom options to pass to [fzf] during interactive selection. See + [`man fzf`][fzf-man] 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`. + - By default, this is set to 10000. - `_ZO_RESOLVE_SYMLINKS` - - When set to `1`, `z` will resolve symlinks before adding directories to the + - When set to 1, `z` will resolve symlinks before adding directories to the database. ## Third-party integrations diff --git a/man/zoxide-init.1 b/man/zoxide-init.1 index 0f1c314..38748d9 100644 --- a/man/zoxide-init.1 +++ b/man/zoxide-init.1 @@ -76,7 +76,10 @@ Add this to your configuration: .B --cmd Changes the prefix of predefined aliases (\fBz\fR, \fBzi\fR). .br -e.g. --cmd j would change the aliases to j and ji respectively. +\fB--cmd j\fR would change the aliases to (\fBj\fR, \fBji\fR). +.br +\fB--cmd cd\fR would replace the \fBcd\fR command (doesn't work on Nushell / +POSIX shells). .TP .B -h, --help Print help information. diff --git a/man/zoxide.1 b/man/zoxide.1 index fd205c8..fcd88e1 100644 --- a/man/zoxide.1 +++ b/man/zoxide.1 @@ -86,11 +86,12 @@ By default, this is set to \fB$HOME\fR. After setting this up, you might need to use \fBzoxide-remove\fR(1) to remove any existing entries from the database. .TP .B _ZO_FZF_OPTS -Custom options to pass to fzf. See \fBfzf\fR(1) for the list of options. +Custom options to pass to fzf during interactive selection. See \fBfzf\fR(1) for +the list of options. .TP .B _ZO_MAXAGE Configures the aging algorithm, which limits the maximum number of entries in -the database. By default, this is set to \fB10000\fR. +the database. By default, this is set to 10000. .TP .B _ZO_RESOLVE_SYMLINKS When set to 1, \fBz\fR will resolve symlinks before adding directories to diff --git a/src/shell.rs b/src/shell.rs index 6199a04..ae44243 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -188,27 +188,6 @@ mod tests { } } - #[rstest] - fn posix_bashposix( - #[values(None, Some("z"))] cmd: Option<&str>, - #[values(InitHook::None, InitHook::Prompt, InitHook::Pwd)] hook: InitHook, - #[values(false, true)] echo: bool, - #[values(false, true)] resolve_symlinks: bool, - ) { - let opts = Opts { cmd, hook, echo, resolve_symlinks }; - let source = Posix(&opts).render().unwrap(); - - let assert = Command::new("bash") - .args(&["--posix", "--noprofile", "--norc", "-c", &source]) - .assert() - .success() - .stderr(""); - - if opts.hook != InitHook::Pwd { - assert.stdout(""); - } - } - #[rstest] fn posix_dash( #[values(None, Some("z"))] cmd: Option<&str>, diff --git a/templates/powershell.txt b/templates/powershell.txt index ad8323b..110aa5d 100644 --- a/templates/powershell.txt +++ b/templates/powershell.txt @@ -107,8 +107,8 @@ function __zoxide_zi { {%- match cmd %} {%- when Some with (cmd) %} -Set-Alias {{cmd}} __zoxide_z -Set-Alias {{cmd}}i __zoxide_zi +Set-Alias -Name {{cmd}} -Value __zoxide_z -Option AllScope +Set-Alias -Name {{cmd}}i -Value __zoxide_zi -Option AllScope {%- when None %}