Started experimenting with #FishShell today, to replace my #zsh when outside of Emacs & Eshell.
-
Gergely Nagy 🐁replied to Himbo In Disguise last edited by
@bean oooh! I will need to update my direnv! My version doesn't have that yet.
Will also check z (was on my todo list anyway, now it got bumped higher), to see if it behaves better than zoxide. I suppose, it being pure fish, it just might.
Thanks! (For fish, too!)
-
Himbo In Disguisereplied to Gergely Nagy 🐁 last edited by
@algernon (note there's some weirdness with overriding "cd" specifically because fish actually has its own wrapper function that adds the directory history etc - it's on my docket to remove that and add it to the builtin proper)
-
Gergely Nagy 🐁replied to Himbo In Disguise last edited by
@bean yeah, noticed. Zoxide makes a copy, and uses the copy internally, so a later alias works.
-
Gergely Nagy 🐁replied to Gergely Nagy 🐁 last edited by
Progress!
Thanks to @bean,
direnv
is sorted! I also havecd
aliased tozoxide
, and it works.However,
cd f
does not offer an autosuggestion at all, even thoughcd forgejo/forgejo
works, and has been used in that fish session too.In this case, I think a video shows my problem better than I can explain:
https://asciinema.org/a/N2ckKLEnvf9ep5yHfyadfpQzAShown therein is how my
cd
works in zsh, and how it does in fish. I want that auto-suggestion in fish, too. The same way it auto-suggests~/src/ext/forgejo/forgejo
, I'd like it to auto-suggestforgejo/forgejo
too, if it's in the history (it is, though that's not shown in the video, and I cba to record it again). -
Gergely Nagy 🐁replied to Gergely Nagy 🐁 last edited by
I might not switch to #FishShell myself (
cd
not auto-suggesting the way I'm used to is a Big Deal), but it will be a perfect shell on Wife's laptop.She's never going to drop into shell herself, but I will, and a stock fish shell will do just fine! Saves me from having to deploy my zsh configuration to her laptop too.
It is also very likely that I will set it as the default shell for the twins, when they get their own computers in a few years time. They likely won't use the shell much either, but if they do, I want them to have something that is friendly out of the box.
-
@algernon
```
zoxide init --cmd cd fish | source
```
zoxide is a phenomenal `cd` modifier. It remembers your most used directories and can fuzzy match them. -
@Brahn Yeah, I'm using that. It makes
cd blah
work, but it does not makecd b
auto-suggestcd blah
. When usingz blah
,z b
will auto-suggestz blah
- I want the same forcd
.cd b<TAB>
does not tab-complete tocd blah
either (I can live with that, I want the auto-suggest, the tab completion is unnecessary).See the zsh & fish comparison video here: https://asciinema.org/a/N2ckKLEnvf9ep5yHfyadfpQzA
-
Gergely Nagy 🐁replied to Gergely Nagy 🐁 last edited by
HAH!
I found the culprit! Fish treats
cd
specially when validating autosuggests, even if I overrode the stockcd
function.I can patch this.
Should I? I dunno. Probably not. But now that I found it, I will. Might even turn it into a settable option and submit it upstream or something.
But I'll check if there's an existing PR or issue about this.
-
@algernon ooh... you want zoxide autocomplete... now I want that.
-
-
@algernon ha! it works!
```
function __zoxide_cd_complete
set -l query (commandline --current-token)
if test -n "$query"
set -l matches (zoxide query --list -- $query)
for match in $matches
echo "$match"
end
end
end# Use zoxide query for cd completions
complete -c cd -f -a '(__zoxide_cd_complete)'
``` -
Gergely Nagy 🐁replied to Gergely Nagy 🐁 last edited by
I did the thing, I patched fish to stop it from special-casing
cd
when validating auto-suggests from history.The raw patch (against 3.7.1, because that is what's in NixOS 24.05) is here.
And with this, it looks like #FishShell will be able to replace #zsh for me too, not just for the rest of the family. I will be experimenting with it for a few more days though, before I commit to it.
-
@algernon If you just wanna get rid of the long direnv output:
```
λ cat ~/.config/direnv/direnv.toml
[global]
hide_env_diff = true
```(needs a recent direnv from this year or so)
-
@jankatins Yep! Was told about that earlier, and am using it now
-
Matija Šukljereplied to Gergely Nagy 🐁 last edited by
@algernon, the only major issue I still have with #FishShell is the lack of alphabet globbing.
Here's the relevant issue and my current workaround:
https://github.com/fish-shell/fish-shell/issues/3681#issuecomment-2341736648 -
Gergely Nagy 🐁replied to Matija Šuklje last edited by
@hook Luckily, I'm not affected. I'm not doing anything serious in neither fish or zsh. Any file renamings or complicated operations are done in Eshell, fish/zsh is only used for some light interactive purposes, where doing it from Emacs would be inconvenient for one reason or another.