
Fish shell 2.0 - siteshwar
http://ridiculousfish.com/blog/posts/fish_shell.html
======
SnowLprd
🐟 Fish rocks. I've been using it exclusively for the last year, and I can't
imagine giving it up.

There seem to be a number of misconceptions, which I will endeavor to address.
The first is: "Fish isn't POSIX/bash-compliant, so there are compatibility
problems." POSIX non-compliance is a feature, not a disadvantage, of the fish
shell. It means there is less legacy baggage and syntactical inconsistency. I
can count the number of POSIX/bash compliance-related issues I've had with
fish on one hand, all of which were easily dealt with. For example, Vim
assumes that your shell is _sh_ compatible, but adding _set shell=sh_ in your
.vimrc solves that. The only other significant one for me was
virtualenvwrapper, which doesn't support fish. Not a problem: Virtualfish
solves that handily: <https://github.com/adambrenecki/virtualfish>

Want to run a bash script? Just run _bash fooshnizzle.sh_. Want to switch to
bash for a moment? Run _bash_ and then _exit_ when you want to switch back to
fish. This POSIX-compatibility topic is, in my opinion, much ado about
nothing.

Another misunderstanding seems to be, "I can do XYZ in bash, but fish doesn't
support that." Fish purposefully limits the number of "builtins" -- commands
that fish includes by default -- in order to maintain simplicity. For me,
that's a feature. When I find that there's something I want to be easier to do
in fish, I whip up a tiny function to do it. Not only is that extremely easy
to do in fish, but then that command performs precisely the way _I_ want it
to. I haven't pushed many of those to my dotfile repository yet, but you can
check out some of my fish functions there:
<https://github.com/justinmayer/dotfiles/tree/master/fish>

Fish is fast, the auto-completion is amazingly helpful, and it's intuitive to
use without too much configuration. Give it a try. 🐟

~~~
sliverstorm
I just wish it didn't insist on doing _everything_ differently. For example,
PATH is traditionally delimited with colons in just about every shell; fish
uses spaces. This instantly breaks compatibility with legacy environment
configuration, and for no particularly good reason that I can see.

I was excited to try fish, but I found it impossible to get configured in an
established environment with entrenched bash usage (which zsh, by the way, has
no problem with)

~~~
ridiculous_fish
Do you mind sharing more details about your legacy environment configuration?
How are you currently setting $PATH? Usually the differences in syntax for
setting variables causes more problems than the colons.

Regarding $PATH: it is actually not delimited at all in fish. Instead, $PATH
is an array, which is a first class notion in fish. This allows for nice
tricks like, say, looping through $PATH:

    
    
       for dir in $PATH
            echo $dir
       end
    

or deleting its last entry:

    
    
        set --erase PATH[-1]
    

Of course, fish flattens $PATH into a colon-delimited string when setting it
as an environment variable, and unflattens it when reading it from the
environment.

~~~
sliverstorm
PATH gets set the way it always did. For example in bash:

export PATH=$PATH:<new_dir>

As for the larger question of environment configuration; we pull in a number
of shell configuration scripts owned by the infrastructure teams. You are
right, there is no universal way to set path due to things like "export" vs
"setenv", but often multiple shells support the same syntax so you can
sometimes use a config script meant for bash in zsh, for example. I had hoped
that fish would be able to use csh scripts, because it shares "setenv", but
csh of course delimits PATH with colons.

You say that PATH is treated as a colon-delimited string when accessed as an
environment variable... Hmm. That wasn't what I was seeing, but it is entirely
possible I made a mess of things, or that I broke things when I compiled it.

Anyway, it's unlikely I personally will be able to use fish. I hit many more
obstacles than just PATH, but that was the easiest example and I thought I'd
share some feedback.

~~~
ridiculous_fish
Thanks for elaborating. Yes, it's a common issue to encounter configuration
scripts, .profile files, etc. that use POSIX syntax, and it's understandable
that people will be unwilling or unable to port them to fish. Usually these
are just standalone scripts which can be run directly via /bin/sh, but
sometimes you want them to be part of your interactive shell.

<https://github.com/fish-shell/fish-shell/issues/522> tracks having a bash
compatibility layer - as you can see there's a lot of discussion!

------
krat0sprakhar
I've been a zsh user for a long time and I have to say that fish is great! Its
super fast and starts almost instantaneously. On zsh, I would always use
fasd[0] to help jump directories, but on fish I dont feel the need. The auto-
completion is just fantastic. If I were you, I'd give it a try just for the
awesome tab completions. For the 'oh-my-zsh' lovers out there, there's 'oh-my-
fish' as well - <https://github.com/bpinto/oh-my-fish>

[0] - <https://github.com/clvv/fasd>

~~~
easytiger
i didn't think zsh startup time was an issue

$ time zsh -c "echo foo" foo

real 0m0.005s user 0m0.002s

~~~
aerique
_Might_ be an OS X thing. At work on Debian zsh starts up instantly, at home
on OS X it takes a good couple of seconds.

~~~
plorkyeran
It's an oh-my-zsh thing, mostly. Turns out that running a lot of scripts on
startup makes startup take a while.

~~~
donri
Thing is in fish functions and completions load lazily as needed, and
basically every customization is done with functions. Startup is pretty much
instant regardless of configuration.

------
c-oreills
Are there still compatibility issues with using fish 2.0 as your default
shell? The Arch Wiki [0] advises against it because it's non bash compliant.

I'm going to give it a go regardless but wanted to know if there were pitfalls
and what people have done to alleviate them.

[0] <https://wiki.archlinux.org/index.php/Fish#Troubleshooting>

~~~
thristian
"not bash compliant" really is the main deal-breaker. When you're getting
technical support on some issue and somebody tells you to paste a command into
your terminal, "bash compliance" (or at least POSIX-shell compliance) is
pretty important. When your phone rings at 2AM and somebody asks you to
urgently fix a production problem and you can't figure out what's going on
because the production server doesn't have your custom shell installed, that's
a problem.

It's not a deal-breaker, of course. If you become fluent in POSIX-shell you
can translate between it and your custom shell, and things should be fine...
but becoming fluent in _two_ shells is a lot more work than becoming fluent in
_one_ shell.

If you never need to interact with other people's machines, and other people
never have to interact with yours, then sure, go nuts and install whatever
shell you want.

~~~
beaumartinez
If you install fish on your local machine, you'll still be able to run bash
and punch those commands right into it—just do

    
    
        $ bash
    

And hey presto, back in bash land.

I agree that it makes sense to know the lowest common denominator well before
you go after something better—especially as you'll know straight away if and
why it's "better".

Slightly OT, but I honestly think that "community best of" projects like oh-
my-zss and the Vim ones actually do people a disservice since they are _not_
zsh or Vim, but rather someone's opinionated, non-standard version of them.

~~~
wging
minor correction: I think you meant to write 'oh-my-zsh' above.

------
barrkel
The documentation needs a lot of work. Every 'help' command I've tried just
pops up a web page using xdg-open, which (a) won't work well in a headless SSH
session, never mind a plane, and (b) doesn't make it easy to search for
specifics.

I also don't like the implementation of the prompt text as a function. It's
the first thing I wanted to customize, and it looks like I need to copy and
paste the existing definition of fish_prompt and hack it into shape. There's
no built-in equivalent of \$, so you need to find out if you're root and do it
yourself. And the existing check just does it with a string compare of $USER
with 'root', rather than euid==0.

Hacking preferences in like this isn't a problem to begin with. The real
problem comes down the road, when the defaults change and improve, and you now
have to be concerned with merging your customizations with the new and
improved stuff.

~~~
siteshwar
You can see help pages on command line with 'man commandname' or with
'commandname --help'

Regarding customizing your prompt, try running 'fish_config' and check list of
already available prompts from prompts tab.

~~~
barrkel
The built-in web browser is a cute feature, but all the prompts waste space
with <username>@<hostname>.

Autocompletion - a feature I generally don't use in other contexts - and
reduced functionality seem to be its main USPs. With readline, process
substitution and subshells (for ad-hoc fork/join jobs started from the command
line) it might be competitive with other shells.

For example, a reasonably common pattern for me, on the command line, is:

    
    
        $ for d in *; do 
        test -d "$d" || continue
        (
        cd "$d"
        time-consuming-task-1
        time-consuming-task-2
        ) &
        done
    

I don't think I could do this in fish today without writing a script, as it
doesn't have subshells and can't run functions in the background.

There's also a big advantage in having the shell be the same (or highly
similar) to your preferred ad-hoc scripting language. It means you can
retrieve complex commands from your history and paste them into the script,
with only a slight cleanup to parameterize them. A whole complex operation can
be spiked and tested interactively before being put together into something
reusable - possibly without foreknowledge that the task is going to be that
tedious, or needs to be encapsulated. Zsh looks like a better alternative to
bash for these reasons.

~~~
donri
This should be the translation:

    
    
        for d in *
            test -d $d
            or continue
            begin
                cd $d
                time-consuming-task-1
                time-consuming-task-2
            end &
        end
    

However it errors; seems you can't do `end &`. Probably a bug; I'll report it.
When fixed, I imagine we could actually do it even better with fish:

    
    
        for d in *
            if test -d $d
                cd $d
                time-consuming-task-1
                time-consuming-task-2
            end &
        end

~~~
JanKanis
Fish currently does not support executing shell functions or commands in the
background with &, only external programs. This is a known omission, but the
best way to fix it is to make the shell interpreter code thread safe so we can
actually write multithreaded shell code. Currently fish only uses threads for
potentially blocking i/o operations. But implementing this is quite a bit of
work and has not been done yet.

Having said that, `enc &` erroring is indeed a bug, expected behavior would be
to run the `begin ... end &` block in the foreground anyway.

------
acron0
Why is no one putting in any time to replace the Windows shell (cmd.exe)? The
stock offering is abysmal and Cygwin isn't much better. We could really use
something with a bit of panache like this... Hmmm..

~~~
bliker
For me, powershell has very slow startup time. So I stick with cmd.exe. But it
beefed up quite a bit. I am using:

\- msys-git (I have ls, rm -rf... all unix goodness)

\- clink (better tab completion, history, all around good stuff)

\- console2 (styling)

\- ansicolor (colored prompt)

and also I got some usefull aliases. If you are interested I can write down
some steps for other people to follow.

screenshot <http://i.imgur.com/hATwCVI.png>

~~~
shocks
Wow that's a nice setup. I'm already using clink (my brother is the author),
but I'm checking the rest out now. Thanks!

------
leejoramo
How long does it take for something to show up in brew? I see that Fish has a
pull request issued a five hours ago, but I see quite a number of other items
have pull requests going back months.

~~~
andrethegiant
There's the package fishfish whose version is stable OpenBeta_r2.

~~~
SnowLprd
That version is nearly a year old; the fishfish formula was temporary and will
be removed from Homebrew as soon as the canonical fish formula has been
updated to 2.0. Hopefully the Homebrew maintainers will merge this soon (not
sure what the hold-up is): <https://github.com/mxcl/homebrew/pull/19887>

------
adito
IF YOU READ THIS, YOU MUST TRY fish NOW!!!

Really, this 100x better than bash.

    
    
        1. download and install[0]
        2. read the tutorial[1]
        3. ...
        4. profit
    

[0]: <http://fishshell.com/#platform_tabs>

[1]: <http://fishshell.com/tutorial.html>

------
netmute
I've tried fish a few years ago and wasn't all that impressed with the
features.

That said, the new version is just ace! I gave it 30 minutes and it basically
does everything I do with zsh right now. All that with about 5% of the
configuration effort I put into zsh. Plus, it's so much faster than zsh.

I'll give fish a go as my main shell. Let's see were this goes.

~~~
RBerenguel
Felt the same. Fish worked out of the box, but left me unimpressed about its
abilities compared to zsh (well, I'd give it the same score as to zsh) until I
realised I hadn't configured anything beyond generating man-completion files.
I'll leave fish lying around so I can alt-tab to it and check it from time to
time

------
izietto
Thanks for all the Fish!!!

    
    
                                                  _J""-.
                      .-""L_                     /o )   \ ,';
                 ;`, /   ( o\                    \ ,'    ;  /
                 \  ;    `, /                     "-.__.'"\_;
                 ;_/"`.__.-"

------
gdonelli
Nice work. Please consider to code-signing the package so that it works nicely
with Mountain Lion gatekeeper.

~~~
duaneb
Ironically I believe Mr Fish is an Apple employee.

~~~
nudded
was* if I'm correct.

~~~
BadCRC
he's still listed on LinkedIn as working there..

------
oneandoneis2
Great.. here I am all ready to try switching to zsh and now here's a new
fish..

Which to go for..?

~~~
mjs
I've "skipped" zsh--I tried it a few times, but it didn't seem enough better
than bash for it to be worth learning, converting all my scripts, and so on.
fish does seem worth the effort, and in fact many of my bash scripts and
configuration settings are now unnecessary.

FWIW my (rapidly changing) fish configuration:

<https://github.com/ithinkihaveacat/dotfiles/tree/master/fish>

~~~
nagisa
You likely want to move your environment variables to ~/.pam_environment
instead of setting them in fish configuration.

~~~
mjs
Is ~/.pam_environment that cross platform? I'm trying to use the same config
on Linux and OS X.

------
andy_boot
Can anyone tell me if fishshell 2.0 works with RVM and Virtualenvwrapper?

~~~
thinkdo
I had to install oh-my-fish[0] and enable the RVM plugin to get RVM to work.

[0]<https://github.com/bpinto/oh-my-fish>

~~~
manojlds
The author of that could have been more innovative with the name. The word
fish gives a lot of room to play :)

------
sepeth
As a long time bash user, I thought I can give a chance to fish. But after 30m
later, when I see this [1] I went back to bash.

[1] [http://serverfault.com/questions/164305/how-can-i-set-
enviro...](http://serverfault.com/questions/164305/how-can-i-set-environment-
variable-for-just-one-command-in-fish-shell)

~~~
andrewvc
What's so hard about typing 'env' in front of the line? `env EDITOR=vim
crontab -e`

Also, why are you changing your EDITOR on a one-off basis, that shit should be
permanent.

~~~
sepeth
Ah! you are right. That didn't occur to me, when I was trying fish.

BTW, My point is not specific the EDITOR variable.

------
AlexMax
I used fishshell for the better part of a year and enjoyed the experience.
However, a few things bugged me:

\- Anything that shells out using your default shell seems to assume a bourne-
compatible shell. I remember this biting me when using various emacs commands
that assumed all the world is a bourne shell.

\- Copypasting commands is annoying too, but I've been evaluating zsh for the
past few months and i've been bitten there too...seems like anything that
isn't bash will run into that issue, and you can always just use bash for
those instances.

\- Virtualenv comes with a fish shell script, but last I checked it didn't
actually work.

\- Does fish still throw a hissy fit every time you try and tab-complete a
command and your $PATH has a non-existant path in it?

------
joem86
I would severely miss the history completion. I can't count how many times I
type !vi to return to the last file I was editing while goofing around in
between editing sessions, or !scp to re-upload a fixed package. I understand
the need for simplicity, but hitting the up arrow an undefined number of times
until I see the command I need seems less efficient.

Other than that fish looks really polished and I plan on devoting a few days
to it to give it a fair shake.

~~~
ridiculous_fish
I think you will really like the autosuggestions then. Just begin typing 'vi'
and it will suggest the rest of the last command you typed, like doing a
history search for free. See
[http://fishshell.com/assets/img/screenshots/autosuggestion.p...](http://fishshell.com/assets/img/screenshots/autosuggestion.png)
.

One of the nice features of autosuggestions is that they remember which
arguments were files, and which ones were not. So if you have changed
directories, !vi will edit a file that does not exist - probably not what you
meant to do. The fish autosuggestion won't suggest it at all.

------
olalonde
Somewhat tangential but is there any reason why the IRC chatroom is on OFTC
rather than Freenode? I think it's the first time I see an open source project
using OFTC.

~~~
donri
Possibly a historical artifact; fish was created in a time when the
controversies surrounding lilo were fresh in memory and lilo was still boss.
Actually there is a channel on freenode now, but it's about a third in size.

Other examples of projects officially on OFTC include: debian, tor, open
street map, libvirt/qemu and related tech, ceph, awesomewm, gcc, smuxi... So
fish isn't all alone there.

There are also projects that operate their own networks, such as GNOME and
Mozilla.

------
Osiris
I just found out the other day that in fish you don't need to use the 'cd'
command. You can just type out a path and it'll change to the folder.

~~~
Watabou
You get the same in bash and zsh, it's not exclusive to fish.

Bash: shopt -s autocd

Zsh: setopt autocd

------
vtempest
Interesting idea with potential, but poor implementation. I tried to type sudo
apt-get and it didn't even autofill my most used commands. I also use the
guake shell client, I would want it integrated in that

~~~
delinka
AFAIK, it tracks its own history separately from other shells. It's not going
to read .bash_history (or whatever) to discover your usage patterns - you'll
have to use fish for awhile and build some history.

~~~
ridiculous_fish
In fact, fish 2.0 will import from .bash_history if it has no history of its
own. <https://github.com/fish-shell/fish-shell/issues/66>

------
moystard
Like many, I have switched to zsh a few months back and have enjoyed the
experience thanks to Oh-My-Zsh. I will give it a go, but I don't know if I can
really appreciate the difference.

~~~
haarts
I think you will. Perhaps not so much when using oh-my-zsh but when you want
to tweak your prompt I find fish's syntax far more sane.

~~~
moystard
Having played with it for the last 30 minutes or so, I think I will stick on
Fish Shell. Surprised (and amazed) by how simple it was to get started and set
up my traditional startup scripts. And the auto-completion is just amazing.

------
hebz0rl
I wonder if keychain now works with fish (didn't with the last version) or is
there an alternative to get fish working with the ssh-agent?

~~~
SnowLprd
I've been using fish with ssh-agent for the last year without any problems.

------
rob22
Its Very Nice shell & better than bash...

~~~
tinsel
how do you change the motd, or remove it entirely?

its annoying having

Welcome to fish, the friendly interactive shell Type help for instructions on
how to use fish

come up all the time

~~~
tyilo
set -x fish_greeting ""

~~~
donri
You probably meant set -U because you probably don't want to export
fish_greeting to child processes. fish_greeting is already universal though
and you don't need the empty string to unset it. This is enough:

    
    
        set fish_greeting

------
danbmil99
fish awesome

