diff --git a/README.md b/README.md index 9b1a518..6f4b224 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ zoxide import --from autojump path/to/db #### `bash` -Add the following line to your configuration file (usually `~/.bashrc`): +Add this to your configuration (usually `~/.bashrc`): ```sh eval "$(zoxide init bash)" @@ -115,7 +115,7 @@ eval "$(zoxide init bash)" #### `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) @@ -123,8 +123,7 @@ eval $(zoxide init elvish | slurp) #### `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 @@ -138,16 +137,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` -Add the following line to your profile: +Add this to your configuration (the location is stored in `$profile`): ```powershell Invoke-Expression (& { @@ -158,7 +159,7 @@ Invoke-Expression (& { #### `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') @@ -166,7 +167,7 @@ execx($(zoxide init xonsh), 'exec', __xonsh__.ctx, filename='zoxide') #### `zsh` -Add the following line to your configuration file (usually `~/.zshrc`): +Add this to your configuration (usually `~/.zshrc`): ```sh eval "$(zoxide init zsh)" @@ -174,8 +175,7 @@ eval "$(zoxide init zsh)" #### Any POSIX shell -Add the following line to your configuration file (usually -`~/.config/nu/config.toml`): +Add this to your configuration: ```sh eval "$(zoxide init posix --hook prompt)" diff --git a/man/zoxide-init.1 b/man/zoxide-init.1 index 0625ba7..91ed1a6 100644 --- a/man/zoxide-init.1 +++ b/man/zoxide-init.1 @@ -7,49 +7,44 @@ zoxide-init - generate shell configuration for zoxide To initialize zoxide on your shell: .TP .B bash -Add the following line to your configuration file (usually \fI~/.bashrc\fR): +Add this to your configuration (usually \fI~/.bashrc\fR): .sp .nf \fBeval "$(zoxide init bash)"\fR .fi .TP .B elvish -Add the following line to your configuration file (usually -\fI~/.elvish/rc.elv\fR): +Add this to your configuration (usually \fI~/.elvish/rc.elv\fR): .sp .nf \fBeval $(zoxide init elvish | slurp)\fR .fi .TP .B fish -Add the following line to your configuration file (usually -\fI~/.config/fish/config.fish\fR): +Add this to your configuration (usually \fI~/.config/fish/config.fish\fR): .sp .nf \fBzoxide init fish | source\fR .fi .TP .B nushell -Initialize zoxide's Nushell script: +Create a Nushell script: .sp .nf \fBzoxide init nushell --hook prompt | save ~/.zoxide.nu\fR .fi .sp -Then, in your Nushell configuration file (usually -\fI~/.config/nu/config.toml\fR): -.sp -* Prepend \fB__zoxide_hook;\fR to the \fBprompt\fR variable. -.sp -* Add the following lines to the \fBstartup\fR variable: +Add this to your configuration (usually \fI~/.config/nu/config.toml\fR): .sp .nf - \fBzoxide init nushell --hook prompt | save ~/.zoxide.nu - source ~/.zoxide.nu\fR + \fBprompt = "__zoxide_hook;__zoxide_prompt"\fR + \fBstartup = ["zoxide init nushell --hook prompt | save ~/.zoxide.nu", "source ~/.zoxide.nu"]\fR .fi +.sp +You can replace \fB__zoxide_prompt\fR with a custom prompt. .TP .B powershell -Add the following line to your profile: +Add this to your configuration (the location is stored in \fI$profile\fR): .sp .nf \fBInvoke-Expression (& { @@ -59,14 +54,14 @@ Add the following line to your profile: .fi .TP .B xonsh -Add the following line to your configuration file (usually \fI~/.xonshrc\fR): +Add this to your configuration (usually \fI~/.xonshrc\fR): .sp .nf \fBexecx($(zoxide init xonsh), 'exec', __xonsh__.ctx, filename='zoxide')\fR .fi .TP .B zsh -Add the following line to your configuration file (usually \fI~/.zshrc\fR): +Add this to your configuration (usually \fI~/.zshrc\fR): .sp .nf \fBeval "$(zoxide init zsh)"\fR @@ -74,7 +69,7 @@ Add the following line to your configuration file (usually \fI~/.zshrc\fR): .TP .B Any POSIX shell .sp -Add the following line to your configuration file: +Add this to your configuration: .sp .nf \fBeval "$(zoxide init posix --hook prompt)"\fR diff --git a/templates/bash.txt b/templates/bash.txt index 7909716..e2245f6 100644 --- a/templates/bash.txt +++ b/templates/bash.txt @@ -120,7 +120,6 @@ function {{cmd}}i() { {%- endmatch %} {{ section }} -# To initialize zoxide with bash, add the following line to your bash -# configuration file (usually ~/.bashrc): +# To initialize zoxide, add this to your configuration (usually ~/.bashrc): # # eval "$(zoxide init bash)" diff --git a/templates/elvish.txt b/templates/elvish.txt index b4d2999..68d2593 100644 --- a/templates/elvish.txt +++ b/templates/elvish.txt @@ -80,7 +80,7 @@ edit:add-var zi~ $__zoxide_zi~ {%- endmatch %} {{ section }} -# To initialize zoxide with xonsh, add the following line to your elvish -# configuration file (usually ~/.elvish/rc.elv): +# To initialize zoxide, add this to your configuration (usually +# ~/.elvish/rc.elv): # # eval $(zoxide init elvish | slurp) diff --git a/templates/fish.txt b/templates/fish.txt index c970983..b71b4ff 100644 --- a/templates/fish.txt +++ b/templates/fish.txt @@ -104,7 +104,7 @@ end {%- endmatch %} {{ section }} -# To initialize zoxide with fish, add the following line to your fish -# configuration file (usually ~/.config/fish/config.fish): +# To initialize zoxide, add this to your configuration (usually +# ~/.config/fish/config.fish): # # zoxide init fish | source diff --git a/templates/nushell.txt b/templates/nushell.txt index da786c5..d90b033 100644 --- a/templates/nushell.txt +++ b/templates/nushell.txt @@ -1,6 +1,16 @@ {%- let section = "# =============================================================================\n#" -%} {%- let not_configured = "# -- not configured --" -%} +{{ section }} +# Utility functions for zoxide. +# + +# Default prompt for Nushell. +# Taken from: +def __zoxide_prompt [] { + build-string $(ansi gb) $(pwd) $(ansi reset) '(' $(ansi cb) $(do -i { git rev-parse --abbrev-ref HEAD } | str trim) $(ansi reset) ')' $(ansi yb) $(date format '%m/%d/%Y %I:%M:%S%.3f %p') $(ansi reset) '> ' +} + {{ section }} # Hook configuration for zoxide. # @@ -79,14 +89,13 @@ alias {{cmd}}i = __zoxide_zi '' {%- endmatch %} {{ section }} -# To initialize zoxide with Nushell: -# -# Initialize zoxide's Nushell script: +# To initialize zoxide, first create a Nushell script: # # zoxide init nushell --hook prompt | save ~/.zoxide.nu # -# Then, in your Nushell configuration file: -# - 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` +# Add this to your configuration (usually ~/.config/nu/config.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. diff --git a/templates/posix.txt b/templates/posix.txt index f5788bc..9088b6b 100644 --- a/templates/posix.txt +++ b/templates/posix.txt @@ -115,7 +115,6 @@ __zoxide_unset '{{cmd}}i' {%- endmatch %} {{ section }} -# To initialize zoxide with your POSIX shell, add the following line to your -# shell configuration file: +# To initialize zoxide, add this to your configuration: # # eval "$(zoxide init posix --hook prompt)" diff --git a/templates/powershell.txt b/templates/powershell.txt index 74762eb..6379587 100644 --- a/templates/powershell.txt +++ b/templates/powershell.txt @@ -101,7 +101,7 @@ Set-Alias {{cmd}}i __zoxide_zi {%- endmatch %} {{ section }} -# To initialize zoxide with powershell, add the following line to your -# powershell configuration file (the location is stored in $profile): +# To initialize zoxide, add this to your configuration (the location is stored +# in $profile): # # Invoke-Expression (& { $hook = if ($PSVersionTable.PSVersion.Major -ge 6) { 'pwd' } else { 'prompt' } (zoxide init powershell --hook $hook) -join "`n" }) diff --git a/templates/xonsh.txt b/templates/xonsh.txt index dd19f6d..07f4d2d 100644 --- a/templates/xonsh.txt +++ b/templates/xonsh.txt @@ -163,7 +163,6 @@ aliases["{{cmd}}i"] = __zoxide_zi {%- endmatch %} {{ section }} -# To initialize zoxide with xonsh, add the following line to your xonsh -# configuration file (usually ~/.xonshrc): +# To initialize zoxide, add this to your configuration (usually ~/.xonshrc): # # execx($(zoxide init xonsh), 'exec', __xonsh__.ctx, filename='zoxide') diff --git a/templates/zsh.txt b/templates/zsh.txt index 5d004b2..b95f733 100644 --- a/templates/zsh.txt +++ b/templates/zsh.txt @@ -105,7 +105,6 @@ function {{cmd}}i() { {%- endmatch %} {{ section }} -# To initialize zoxide with zsh, add the following line to your zsh -# configuration file (usually ~/.zshrc): +# To initialize zoxide, add this to your configuration (usually ~/.zshrc): # # eval "$(zoxide init zsh)"