diff --git a/CHANGELOG.md b/CHANGELOG.md index efaefbc..92c70bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## [0.4.0] - 2020-05-03 ### Added @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `$_ZO_ECHO` now only works when set to `1`. - Using the `--z-cmd` flag now also renames the associated aliases. - The `--z-cmd` flag has been renamed to `--cmd`. +- The `--no-define-aliases` flag has been renamed to `--no-aliases`. ### Fixed @@ -120,6 +121,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - GitHub Actions pipeline to build and upload releases. - Support for the `zsh` shell. +[0.4.0]: https://github.com/ajeetdsouza/zoxide/compare/v0.3.1...v0.4.0 [0.3.1]: https://github.com/ajeetdsouza/zoxide/compare/v0.3.0...v0.3.1 [0.3.0]: https://github.com/ajeetdsouza/zoxide/compare/v0.2.2...v0.3.0 [0.2.2]: https://github.com/ajeetdsouza/zoxide/compare/v0.2.1...v0.2.2 diff --git a/Cargo.lock b/Cargo.lock index b068931..47d69b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -430,7 +430,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "zoxide" -version = "0.3.1" +version = "0.4.0" dependencies = [ "anyhow 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 5b69452..9c79762 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "zoxide" -version = "0.3.1" +version = "0.4.0" authors = ["Ajeet D'Souza <98ajeet@gmail.com>"] -description = "A cd command that learns your habits" +description = "A faster way to navigate your filesystem" repository = "https://github.com/ajeetdsouza/zoxide/" edition = "2018" diff --git a/README.md b/README.md index 084778c..7f8a86e 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![crates.io](https://img.shields.io/crates/v/zoxide)](https://crates.io/crates/zoxide) ![.github/workflows/release.yml](https://github.com/ajeetdsouza/zoxide/workflows/.github/workflows/release.yml/badge.svg) -A cd command that learns your habits +A faster way to navigate your filesystem ## Table of contents @@ -12,10 +12,10 @@ A cd command that learns your habits - [Getting started](#getting-started) - [Installing `zoxide`](#step-1-installing-zoxide) - [Adding `zoxide` to your shell](#step-2-adding-zoxide-to-your-shell) - - [zsh](#zsh) - [bash](#bash) - [fish](#fish) - - [POSIX](#posix) + - [POSIX](#posix-shells) + - [zsh](#zsh) - [Configuration](#configuration) - [`init` flags](#init-flags) - [Environment variables](#environment-variables) @@ -71,14 +71,6 @@ your existing database into `zoxide`: zoxide import /path/to/db ``` -#### zsh - -Add the following line to your `~/.zshrc`: - -```sh -eval "$(zoxide init zsh)" -``` - #### bash Add the following line to your `~/.bashrc`: @@ -95,57 +87,57 @@ Add the following line to your `~/.config/fish/config.fish`: zoxide init fish | source ``` -#### POSIX +#### POSIX shells Add the following line to your shell's configuration file: ```sh -eval "$(zoxide init posix)" +eval "$(zoxide init posix --hook prompt)" ``` -NOTE: If you modify your `PS1` at any point, you may need to re-run the above command. This is due -to the fact that the hook is stored in `PS1`, in order to be evaluated every time the prompt is -displayed. +The `prompt` hook is recommended for POSIX shells because the default `pwd` +hook creates a temporary file for every session, which are only deleted upon +reboot. If you do want to use `pwd` hooks instead, you may want to set up traps +to perform a cleanup once the shell exits: -NOTE: PWD hooks are currently not supported for POSIX shells. +```sh +trap '_zoxide_cleanup' EXIT HUP KILL TERM +trap '_zoxide_cleanup; trap - INT; kill -s INT "$$"' INT +trap '_zoxide_cleanup; trap - QUIT; kill -s QUIT "$$"' QUIT +``` + +NOTE: If you modify your `PS1` at any point, you may need to re-run the above +command. This is due to the fact that the hook is stored in `PS1`, in order to +be evaluated every time the prompt is displayed. + +#### zsh + +Add the following line to your `~/.zshrc`: + +```sh +eval "$(zoxide init zsh)" +``` ## Configuration ### `init` flags -- `--hook `: change the event that adds a new entry to the database (default: `prompt`) - - `none`: never add entries (this will make `zoxide` useless unless you manually configure a hook) +- `--cmd`: change the `z` command (and corresponding aliases) to something else +- `--hook `: change the event that adds a new entry to the database + (default: `pwd`) + - `none`: never add entries + (this will make `zoxide` useless unless you manually configure a hook) - `prompt`: add an entry at every prompt - - `pwd`: add an entry whenever you change directories -- `--no-define-aliases`: don't define extra aliases like `zi`, `zq`, `za`, and `zr` -- `--z-cmd`: rename the `z` command to something else + - `pwd`: add an entry whenever the current directory is changed +- `--no-aliases`: don't define extra aliases like `zi`, `zq`, `za`, and `zr` ### Environment variables -- `$_ZO_DATA_DIR`: directory where `zoxide` will store its data files (default: - platform-specific; see the [`dirs` documentation] for more information) -- `$_ZO_ECHO`: `z` will print the matched directory before navigating to it -- `$_ZO_EXCLUDE_DIRS`: list of directories separated by platform-specific - characters ("`:`" on Linux and macOS, and "`;`" on Windows) to be excluded from - the database +- `$_ZO_DATA_DIR`: directory where `zoxide` will store its data files + (default: platform-specific; see the [`dirs` documentation] for more information) +- `$_ZO_ECHO`: when set to `1`, `z` will print the matched directory before navigating to it +- `$_ZO_EXCLUDE_DIRS`: list of directories separated by platform-specific characters + ("`:`" on Linux/macOS, "`;`" on Windows) to be excluded from the database - `$_ZO_MAXAGE`: sets the maximum total rank after which entries start getting deleted [`dirs` documentation]: https://docs.rs/dirs/latest/dirs/fn.data_local_dir.html - -## Notes - -If you recently updated `zoxide` from an older version to `v0.3` and are -seeing the following error: - -``` -Error: could not deserialize old database - -Caused by: - io error: failed to fill whole buffer -``` - -It is because v0.2 and v0.3 databases are incompatible. There is a script to -automatically migrate your database to the new format, but it seems to be -failing on some systems. - -For a quick fix, you can try removing the old database file: `rm ~/.zo`