Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Very poor support for alias:

    batman@batman ~/D/S/rails> alias foo="cd ~/"
    fish: Could not expand string '$tmp[2]'
    /usr/local/share/fish/functions/alias.fish (line 19): 			set body $tmp[2]
                                                                                           ^
    in function 'alias',
      called on standard input,
      with parameter list 'foo=cd ~/'
Makes me wonder what else I'll have to relearn to use fish. Can someone tell me if it's worth the effort?

Edit: didn't take me long to find something worse. I defined my aliases as functions, but apparently fish executes all functions when it sources the file? By putting this function in:

    function foo
    cd ~/
    end
I was able to send fish into an infinite loop.


Howdy, author here.

fish doesn't have aliases, only functions. 'alias' is itself a function, which looks like it has a bug. I filed https://github.com/ridiculousfish/fishfish/issues/48 to track this.

(The usual way a fish user would add this function would be to put a file 'foo.fish' in ~/.config/fish/functions, or to use 'funced fish' to create one interactively.)

As for your infinite loop - fish certainly does not execute all functions when it sources the file. I wasn't able to reproduce your problem. Can you explain how you added this function?

Thanks!


I never use alias in fish, just functions - see the Fish design document, law of orthogonality: http://fishshell.com/user_doc/design.html#ortho

That infinite loop thing is a bug for sure, it shouldn't do that! I have defined that type of function to jump to the directories of current projects - that should work.


> I have defined that type of function to jump to the directories of current projects - that should work.

What do you mean? Even if I define a function like so:

    function foo; cd /var; end
It shouldn't automatically execute the function and cd into /var.


No, exactly, for me it wouldn't.

For example, I'd type something like this:

  function gogogo
    cd ~/src/teh_project
  end
  funcsave gogogo
Then the "gogogo" function is available in all shells and loaded on startup - but not executed until I do so myself. From what I understand you wish to have the same functionality, and are doing the same thing, but are getting totally weird results.

Explicitly: No, it definitely shouldn't try to run functions right away. Bug!

FWIW I haven't tried the fishfish fork/update, just used the original version for a number of years.

It'd be greatly appreciated if you could spare a moment to send a bug report! (I'm not a dev by any means, just a fish lover ...)


It totally worths the effort. It wouldn't take more than an hour, but even if it would take you 10 hours, it would still worth the time.


Could you elaborate? What features do you regularly use? What happens when you log in to a machine that doesn't have fish?


That alias-example works for me with the current fish version from Arch-Linux. (And that seems to be the fishfish fork, from what I can tell.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: