-
Notifications
You must be signed in to change notification settings - Fork 635
Update zoxide to support Fish 4.1.x #1046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This commit updates the fish init script to support the upcoming 4.1.x release of Fish by using `status get-file`. Fixes ajeetdsouza#1045
templates/fish.txt
Outdated
@@ -19,7 +19,11 @@ end | |||
# A copy of fish's internal cd function. This makes it possible to use | |||
# `alias cd=z` without causing an infinite loop. | |||
if ! builtin functions --query __zoxide_cd_internal | |||
string replace --regex -- '^function cd\s' 'function __zoxide_cd_internal ' <$__fish_data_dir/functions/cd.fish | source | |||
if status list-files functions/cd.fish >/dev/null | |||
source (string replace --regex -- '^function cd\s' 'function __zoxide_cd_internal ' (status get-file functions/cd.fish) | psub -f) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Piping to source
like above (and to string
) is fine, shorter and works better:
status get-file functions/cd.fish | string replace --regex -- '^function cd\s' 'function __zoxide_cd_internal ' | source
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to piping and reverted the 3.x case to the original.
templates/fish.txt
Outdated
@@ -19,7 +19,11 @@ end | |||
# A copy of fish's internal cd function. This makes it possible to use | |||
# `alias cd=z` without causing an infinite loop. | |||
if ! builtin functions --query __zoxide_cd_internal | |||
string replace --regex -- '^function cd\s' 'function __zoxide_cd_internal ' <$__fish_data_dir/functions/cd.fish | source | |||
if status list-files functions/cd.fish >/dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this also needs 2>/dev/null
(could use the &>/dev/null
shorthand),
else it will print an error on fish version 3
This commit updates the fish init script to support the upcoming 4.1.x release of Fish by using
status get-file
.Fixes #1045