mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2024-11-16 10:05:20 +00:00
Add default prompt for nushell (#191)
This commit is contained in:
parent
7d9ca0de43
commit
0f5fde5afa
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Added
|
||||
|
||||
- Manpages for each subcommand.
|
||||
- Default prompt for Nushell.
|
||||
|
||||
### Fixed
|
||||
|
||||
|
28
README.md
28
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)"
|
||||
|
@ -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
|
||||
|
@ -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)"
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,16 @@
|
||||
{%- let section = "# =============================================================================\n#" -%}
|
||||
{%- let not_configured = "# -- not configured --" -%}
|
||||
|
||||
{{ section }}
|
||||
# Utility functions for zoxide.
|
||||
#
|
||||
|
||||
# Default prompt for Nushell.
|
||||
# Taken from: <https://github.com/nushell/nushell/blob/main/docs/sample_config/config.toml>
|
||||
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.
|
||||
|
@ -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)"
|
||||
|
@ -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" })
|
||||
|
@ -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')
|
||||
|
@ -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)"
|
||||
|
Loading…
Reference in New Issue
Block a user