mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2024-11-22 04:45:20 +00:00
Add support for older Fish versions
This commit is contained in:
parent
4f475a75cb
commit
4dff2b1602
@ -11,7 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Added
|
||||
|
||||
- Fish/Zsh: Aliases on `__zoxide_z` will now use completions.
|
||||
- Fish/Zsh: aliases on `__zoxide_z` will now use completions.
|
||||
- Nushell: add support for v0.78.0.
|
||||
- Fish: plugin now works on older versions.
|
||||
|
||||
## [0.9.0] - 2023-01-08
|
||||
|
||||
|
@ -196,9 +196,6 @@ zoxide can be installed in 4 easy steps:
|
||||
> ```fish
|
||||
> zoxide init fish | source
|
||||
> ```
|
||||
>
|
||||
> **Note**
|
||||
> zoxide only supports fish v3.4.0 and above.
|
||||
|
||||
</details>
|
||||
|
||||
|
@ -28,8 +28,6 @@ Add this to your configuration (usually \fB~/.config/fish/config.fish\fR):
|
||||
.nf
|
||||
\fBzoxide init fish | source\fR
|
||||
.fi
|
||||
.sp
|
||||
Note: zoxide only supports fish v3.4.0 and above.
|
||||
.TP
|
||||
.B nushell
|
||||
Add this to your env file (find it by running \fB$nu.env-path\fR in Nushell):
|
||||
|
@ -6,7 +6,7 @@ use askama::Template;
|
||||
use crate::cmd::{Init, InitShell, Run};
|
||||
use crate::config;
|
||||
use crate::error::BrokenPipeHandler;
|
||||
use crate::shell::{self, Opts};
|
||||
use crate::shell::{Bash, Elvish, Fish, Nushell, Opts, Posix, Powershell, Xonsh, Zsh};
|
||||
|
||||
impl Run for Init {
|
||||
fn run(&self) -> Result<()> {
|
||||
@ -16,14 +16,14 @@ impl Run for Init {
|
||||
let opts = &Opts { cmd, hook: self.hook, echo, resolve_symlinks };
|
||||
|
||||
let source = match self.shell {
|
||||
InitShell::Bash => shell::Bash(opts).render(),
|
||||
InitShell::Elvish => shell::Elvish(opts).render(),
|
||||
InitShell::Fish => shell::Fish(opts).render(),
|
||||
InitShell::Nushell => shell::Nushell(opts).render(),
|
||||
InitShell::Posix => shell::Posix(opts).render(),
|
||||
InitShell::Powershell => shell::Powershell(opts).render(),
|
||||
InitShell::Xonsh => shell::Xonsh(opts).render(),
|
||||
InitShell::Zsh => shell::Zsh(opts).render(),
|
||||
InitShell::Bash => Bash(opts).render(),
|
||||
InitShell::Elvish => Elvish(opts).render(),
|
||||
InitShell::Fish => Fish(opts).render(),
|
||||
InitShell::Nushell => Nushell(opts).render(),
|
||||
InitShell::Posix => Posix(opts).render(),
|
||||
InitShell::Powershell => Powershell(opts).render(),
|
||||
InitShell::Xonsh => Xonsh(opts).render(),
|
||||
InitShell::Zsh => Zsh(opts).render(),
|
||||
}
|
||||
.context("could not render template")?;
|
||||
writeln!(io::stdout(), "{source}").pipe_exit("stdout")
|
||||
|
@ -67,7 +67,7 @@ set __zoxide_z_prefix 'z!'
|
||||
# Jump to a directory using only keywords.
|
||||
function __zoxide_z
|
||||
set -l argc (count $argv)
|
||||
set -l completion_regex '^'(string escape --style=regex $__zoxide_z_prefix)'(.*)$'
|
||||
set -l prefix (string escape --style=regex $__zoxide_z_prefix)
|
||||
|
||||
if test $argc -eq 0
|
||||
__zoxide_cd $HOME
|
||||
@ -75,7 +75,7 @@ function __zoxide_z
|
||||
__zoxide_cd -
|
||||
else if test $argc -eq 1 -a -d $argv[1]
|
||||
__zoxide_cd $argv[1]
|
||||
else if set -l result (string match --groups-only --regex $completion_regex $argv[-1])
|
||||
else if set -l result (string replace --regex ^$prefix $argv[-1])
|
||||
__zoxide_cd $result
|
||||
else
|
||||
set -l result (command zoxide query --exclude (__zoxide_pwd) -- $argv)
|
||||
@ -131,5 +131,3 @@ alias {{cmd}}i=__zoxide_zi
|
||||
# ~/.config/fish/config.fish):
|
||||
#
|
||||
# zoxide init fish | source
|
||||
#
|
||||
# Note: zoxide only supports fish v3.4.0 and above.
|
||||
|
Loading…
Reference in New Issue
Block a user