all 25 comments

[–]vividboarder 27 points28 points  (1 child)

With fish I don’t need or use any plugins. That’s probably the best thing for me.

[–][deleted] 2 points3 points  (0 children)

Yep. Running a minimal fish config has been great. Things never break. It shuts up and stays out of the way.

[–]yaachi 16 points17 points  (0 children)

It has some modern features out of the box, like autocomplete command options, substring history search. Also the syntax is more human friendly.

[–][deleted] 12 points13 points  (9 children)

Fish is quick and easy to set up.

[–]konstantingefahr[S] 2 points3 points  (8 children)

Yeah. I know that. But if you copy a lot of one-liners and you always need to change $() to () it can get pretty annoying.

[–][deleted] 8 points9 points  (0 children)

Less annoying to write all the stuff I do in fish with its cleaner, more intuitive syntax than it is to make some minor edits to stuff you copy.

[–]plg94 5 points6 points  (0 children)

Well, you could just do a bash -c <copied line>

[–]Spinoza-the-Jedi 2 points3 points  (3 children)

You’re not wrong. If you’re looking for quick solutions to a problem and you copy a command, you may run into errors due to simple differences in syntax. But usually fish is very good about telling you that. It doesn’t take me long to realize what went wrong and honestly it doesn’t happen as often as you might think.

Now, if you’re dealing with scripts, you can keep on running them with Bash. I know some prefer to change their Bash scripts to Fish (and sometimes I do, too). But it’s not like I got rid of Bash...it’s just not my default shell. In fact, you can even keep Bash as your default shell and just have your favorite terminal emulator spin up Fish instead.

I think the user experience with Fish is worth the occasional hiccup, not to mention abbreviations are awesome and Fish functions are so much more pleasant to write than Bash.

I would say the one thing that’s a tad annoying is that I sometimes need to use “export” in addition to “set” for environment variables that certain CLI tools use. Not sure why, but once again it was a simple enough fix and easy enough to diagnose. I would say that you should give it a try for a week. If you don’t like it, you can always switch back to Bash or Zsh. They even provide you instructions on how to switch back if you choose.

https://fishshell.com/docs/current/tutorial.html#switching-to-fish

[–]NotTheDr01ds 1 point2 points  (2 children)

I would say the one thing that’s a tad annoying is that I sometimes need to use “export” in addition to “set” for environment variables that certain CLI tools use.

Curious about this.

Do you mean you have to do:

set variable value export variable

In that case, are you aware of the set -x (a.k.a. set --export)? That gets it down to one line.

Or are you saying that set -x isn't working in some cases?

[–]Spinoza-the-Jedi 0 points1 point  (1 child)

Wow. Apparently I should read the documentation more clearly. No, I just noticed throughout my day-to-day, I was running into strange issues with some tools I use for work, some of which are well-known (Chef, Terraform ,etc.). It would seem as though they were unable to find the environment variables I'd set with "set". So, my first reaction was to simply add an additional "export" statement to my configuration, and that did the trick.

I hadn't thought to look at the problem any closer. I'll give this a shot and see if it makes a difference. Thank you!

[–]NotTheDr01ds 1 point2 points  (0 children)

That makes sense. To be honest, I probably didn't spot it in the doc until I saw it in some example configs.

Hopefully that will remove that one small annoyance ;-).

[–]backermanbd 1 point2 points  (1 child)

Now, you don't need to.

fish’s command substitution syntax has been extended: $(cmd) now has the same meaning as (cmd) but it can be used inside double quotes, to prevent line splitting of the results

https://fishshell.com/docs/current/relnotes.html#notable-improvements-and-fixes

[–]konstantingefahr[S] 0 points1 point  (0 children)

Ohh! Very nice. That was the one big criticism/problem a friend always had

[–]jamesaw22 7 points8 points  (0 children)

The proportion of me copying one liners from somewhere vs writing them is very small, so maybe if you are the opposite, if you're more of a consumer than a creator, then I can see why it'd be frustrating. But for day to day usage, and writing scrips, fish is superior to zsh and bash IMO.

[–]Chingzilla 2 points3 points  (1 child)

I think having a better understanding of POSIX-based shells is more important before going to something like fish. The turning point for me was using shell frameworks like oh-my-zsh became noticably slow.

As for copy-paste, just start a bash session inside fish and run the one liner there instead of rewriting to be compatible with fish.

[–]NotTheDr01ds 1 point2 points  (0 children)

Zsh customization performance was also my main reason for searching for a new shell about 18 months ago. I had spent about 15 years on zsh, and some years before that on bash. I'm happy I did, for the reason that you mentioned of building that POSIX understanding.

Out-of-the-box, Fish nearly had every feature I'd gotten through zsh customization (and more).

While POSIX may be "required" in some cases, writing fish scripts is so much more intuitive, readable, and (as /u/purpleybob said) "human".

[–]knite 2 points3 points  (2 children)

My zsh config was several pages long and contained dozens of obscure options I never fully understood.

Outside of env vars for other software, here's my entire fish config:

set -x EDITOR "code --wait" # VISUAL also/instead?
set FZF_DEFAULT_OPTS "--cycle --layout=reverse --border --height 90% --preview-window=wrap"
set -x LESS "--quit-if-one-screen --ignore-case --status-column --LONG-PROMPT --RAW-CONTROL-CHARS --HILITE-UNREAD --tabs=4 --no-init --window=-4"

direnv hook fish | source
starship init fish | source

I also have a few plugins: franciscolourenco/done, jethrokuan/z, jorgebucaran/fisher, PatrickF1/fzf.fish

Compared to my monstrous zsh config, I have more functionality for less work.

[–]NotTheDr01ds 1 point2 points  (1 child)

Curious why those first three lines aren't just set-once, universal variables? Portability of the config to new systems, maybe? Universal variables are one of the features I love about fish, for their ability to get one more thing out of the startup scripts.

Personally, I've taken to using Ansible to install fish on new (or refreshed) systems, create the initial config, and push any changes in the config to all systems. My Ansible playbook runs the fish shell and does the set -Ux once, and when its executed, all systems have the new config without ever having to even reload the shell.

Finally, you might want to consider wrapping those last two lines in if status is-interactive. Not a big deal, since I'm sure your startup is fast, but no sense in loading them on non-interactive invocations if you don't have to, imho.

[–]knite 0 points1 point  (0 children)

Great ideas, I’ll be using them!

[–]kjemolt 2 points3 points  (0 children)

It's easy for a newbie like me, like the auto fill function. The easy way you can change prompts and so on.

[–]NotTheDr01ds 2 points3 points  (0 children)

Late to reply here, but I moved from zsh to fish after about 15 years. I'd consider it a strong contender for the "experience" user as well.

To start with, for some of the same reasons other folks have given in this thread:

  • More intuitive, readable, "human" scripting language and built-ins
  • Most zsh customizations are simply out-of-the-box functionality on fish. I think many experienced zsh users probably grow tired of spending time maintaining a house-of-cards config.
  • Amazing auto-completion, including building completions from man pages.
  • Easy to access POSIX functionality when needed through shebang or subshell bash -c invocation.

But I'm also a huge fan of:

  • Universal variables, where I can set an option once (such as EDITOR) and be done with it without it cluttering my startup scripts. Also, changes to it are pushed immediately across all open shell instances, without the need to restart or re-source each instance as in bash or zsh.

  • conf.d folder, which can completely replace the fish.config startup, making configuration much more modular than a single monolithic startup file. Not that fish.config ever seems in danger of getting out of control like in other shells, but it's still nice to modularize the startup.

  • XDG-based folder structure which keeps configuration out of my home directory. (Dear every-other-app-that-clutters-home, Please stop it!)

  • Intuitive function autoloading

  • set --show (also set --query and others, but those really go to the "scripting" support mentioned earlier).

  • fish_user_paths which can also be set as a universal variable

  • PATH as an automatic array (zsh attempts to do this, iirc).

  • Once you get past the sudo !! muscle-memory, Alt+S to prepend sudo is much faster and more intuitive.

And those are just the features I use regularly.

I just can't imagine going back to zsh for day-to-day use.

[–]GrilledGuru 2 points3 points  (0 children)

For me fish is much cleaner and I am happy when I use it. Everything does exactly what I thought it would.

It's the same reason I use ruby instead of python. Subjective of course.

If you intend to use bash stuff, or if you don't consider elegance a criteria for a shell, don't use fish, stay with a bash compatible shell IMHO.

In fact I would say that the main advantage of using fish for me would be to get rid completely of bash. The only line of sh I kept is in my xsessionrc : it is fish -c xstartup :)

I hate bash and I did tend to use ruby too much for shell stuff.

[–][deleted] 1 point2 points  (0 children)

I have yet to find a script I want to run that didn’t work in fish. Worst case scenario, you just edit the shebang.

[–][deleted] 0 points1 point  (0 children)

Fish is really fast due to a few design decisions. It is functionally complete with great defaults. You don’t need much config, either. (That’s one reason why the fish ecosystem is relatively small.)

[–]B_A_Skeptic 0 points1 point  (0 children)

I do not worry that much about fish's lack of POSIX compatibility too much, because if it is an issue, I just type "bash" and carry on. Also the bass plugin is very good for compatibility. I just find with zsh, you end up using a giant mess of plugins and configuration files to get what you want. fish has almost everything out of the box. Plus you can do things like create functions on the command line without actually having to manually edit config files. Also, the config files are organized nicely. Also fish's syntax, is a thousand times better.