From bbcabdec0328a23ecb6d00827ef32fe99b4be7b1 Mon Sep 17 00:00:00 2001 From: Ajeet D'Souza <98ajeet@gmail.com> Date: Thu, 17 Jun 2021 01:38:14 +0530 Subject: [PATCH] docs: add post install instructions for zoxide --- zoxide/README.md | 42 ++++++++++++++++++++++-------------------- zoxide/install.sh | 15 +++++++++++++++ 2 files changed, 37 insertions(+), 20 deletions(-) diff --git a/zoxide/README.md b/zoxide/README.md index 9de855f..4d0ab8b 100644 --- a/zoxide/README.md +++ b/zoxide/README.md @@ -30,31 +30,31 @@ zi foo # cd with interactive selection (requires fzf) To use zoxide, it needs to be first initialized on your shell: -### bash +### `bash` -Add the following line to your configuration file (usually `~/.bashrc`): +Add this to your configuration (usually `~/.bashrc`): ```sh eval "$(zoxide init bash)" ``` -### elvish +### `elvish` -Add the following line to your configuration file (usually `~/.elvish/rc.elv`): +Add this to your configuration (usually `~/.elvish/rc.elv`): ```sh -eval $(zoxide init elvish | slurp) +eval (zoxide init elvish | slurp) ``` -### fish +### `fish` -Add the following line to your configuration file (usually `~/.config/fish/config.fish`): +Add this to your configuration (usually `~/.config/fish/config.fish`): ```fish zoxide init fish | source ``` -### nushell +### `nushell 0.32.0+` Initialize zoxide's Nushell script: @@ -62,16 +62,18 @@ Initialize zoxide's Nushell script: zoxide init nushell --hook prompt | save ~/.zoxide.nu ``` -Then, in your Nushell configuration file: +Add this to your configuration (usually `~/.config/nu/config.toml`): -- Prepend `__zoxide_hook;` to the `prompt` variable. -- Add the following lines to the `startup` variable: - - `zoxide init nushell --hook prompt | save ~/.zoxide.nu` - - `source ~/.zoxide.nu` +```toml +prompt = "__zoxide_hook;__zoxide_prompt" +startup = ["zoxide init nushell --hook prompt | save ~/.zoxide.nu", "source ~/.zoxide.nu"] +``` + +You can replace `__zoxide_prompt` with a custom prompt. -### powershell +### `powershell` -Add the following line to your profile: +Add this to your configuration (the location is stored in `$profile`): ```powershell Invoke-Expression (& { @@ -80,17 +82,17 @@ Invoke-Expression (& { }) ``` -### xonsh +### `xonsh` -Add the following line to your configuration file (usually `~/.xonshrc`): +Add this to your configuration (usually `~/.xonshrc`): ```python execx($(zoxide init xonsh), 'exec', __xonsh__.ctx, filename='zoxide') ``` -### zsh +### `zsh` -Add the following line to your configuration file (usually `~/.zshrc`): +Add this to your configuration (usually `~/.zshrc`): ```sh eval "$(zoxide init zsh)" @@ -98,7 +100,7 @@ eval "$(zoxide init zsh)" ### Any POSIX shell -Add the following line to your configuration file: +Add this to your configuration: ```sh eval "$(zoxide init posix --hook prompt)" diff --git a/zoxide/install.sh b/zoxide/install.sh index 33127b3..0c0c3cd 100644 --- a/zoxide/install.sh +++ b/zoxide/install.sh @@ -36,6 +36,21 @@ function __init_zoxide() { zoxide --version 2>/dev/null | head -n 1 | cut -d '-' -f 1 | cut -b '9-' } + # shellcheck disable=SC2016 + pkg_done_message() { + echo 'zoxide was installed successfully. Next, you'\''ll need to set it up on your shell:' + echo '' + echo '- For bash, add this line to ~/.bashrc:' + echo ' eval "$(zoxide init bash)"' + echo '' + echo '- For fish, add this line to ~/.config/fish/config.fish:' + echo ' zoxide init fish | source' + echo '' + echo '- For zsh, add this line to ~/.zshrc:' + echo ' eval "$(zoxide init zsh)"' + echo '' + echo '- For any other shell, see the instructions at https://github.com/ajeetdsouza/zoxide.' + } } __init_zoxide -- 2.25.1