Skip to content

Instantly share code, notes, and snippets.

@thor314
Created October 3, 2024 20:45
Show Gist options
  • Select an option

  • Save thor314/6a45639fb83f7739657af0587b6b444b to your computer and use it in GitHub Desktop.

Select an option

Save thor314/6a45639fb83f7739657af0587b6b444b to your computer and use it in GitHub Desktop.
Tool-Fish Shell.md

Tool-Fish Shell

tldr

the Bourne shell standard, which most shells comply with (bash, sh, zsh), is kindof bad. Fish is good mostly because it's similar to the standard, but rejects a good portion of the Bourne/POSIX standard. And it is very good: less configuration to get un-annoyed, good interactive shell completions and highlighting OOTB, and a nice update to the clunky POSIX shell standard for shell scripting. Bonus; almost a reason by itself to use this shell, the fish docs are excellent. Search this file, and this cookbook for quick guide on commands.

Todo

  • read introduction, tutorial, faq
  • find plugins
  • fix aliases
  • set up config area
  • how to accept first suggestion with tab instead of right key?

note on bindings for back/fwd

changing working directory with bindings (eg bind \eo prevd, bind \ei nextd) seems good, but prompt doesn't update until next command, so can be confusing. Actually, I can just modify the comand slightly: bind \eo 'prevd; commandline -f repaint' and we're hunky dory.

Docs notes: [[Docs-Fish Introduction, Tutorial, FAQ]]

Code snippets: see [[examples-fish-code-snippets]]

Plugins: see [[tool-fish-plugins]]

First Look-Fish - 2022-11-28

I did a little looking around at the fish shell, and how it differs from the bash shell. It looks like it comes with better syntax highlighting and autocompletion OOTB, but most relevently, Fish for bash users — fish-shell 3.5.1 documentation the fish shell scripts look to have sanded off many of the bash rough edges I've repeatedly bumped into in the past, most saliently that all variables are arrays.

Cons for switching to fish:

  • It might take a day to migrate my settings.
  • I'd be using a less standard shell than zsh.
  • I'd want to poke around a bunch more settings.
  • I'd have to learn a couple modifications and new commands for the fish shell.
  • Fish is non-standard. Pros for switching to fish:
  • shellcheck compatibility,
  • better scripting language,
  • better syntax highlighting.
  • The docs for fish look better than the docs for zsh.

It would likely take on the order of 4 hours (or more) to execute the switch, setting up the shell migrating a config. I wouldn't have to migrate shell scripts, fortunately. There's a prompt here. GitHub - IlanCosman/tide: 🌊 The ultimate Fish prompt.

I might be able to do it incrementally though.

2022-11-30 Hello. I'm Thor from two days in the future.

We installed Fish. It took about 6 hours to read the docs, look into plugins, migrate my aliases, and poke a couple settings. All in all though, I'm pretty happy with the new configuration dir. It's much simpler than it was with zsh, while being significantly more feature complete. Only issue is that I generally disagree with the fish philosophy on abbr>alias; grepping thru aliases is great.

2022-12-01 I take it back

this command simulates what I was able to get from aliases. Ok, I'll use I might use abbrevs. this command simulates what I was able to get from searching thru aliases. Ok I might use abbrevs.

abbr -s | rg merge | sd '.*-- (.*)' '$1'

related

  • topic:: [[Topic-CLI Tools]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment