Archive for November 27, 2006

One thing which bothered me with BASH are its limited completion capabilities, even though you have bash-completion installed.

This made me switch to ZSH some years ago, which felt more right. It has completions for the most common commands and seemed to be much better suited for interactve work. Nevertheless, I never got into shell programming, although ZSH has some nifty stuff that make it really powerful.

Then three weeks ago I fell over fish because of an LWN article. It’s (the article) quite outdated, but shows many of fish’s nice features. A more actual article can be found at Linux.com.

So what makes fish that cool? Why do we need another shell? Well, because it has many features no other shell has, and because it breaks compatibility. (Why in hell does anyone want compatibility with the 25 year old Korn shell, if the only "benefit" is broken usability? Ok, maybe you’re used to it, but try fish anyway!)

Now let’s talk about fish’s features:

  1. Fish has an advanced syntax highlighting. When you type an incomplete or unknown command, it’s colored in red to indicate an error. Once it’s complete, it’s colored in green. An existing path will be underlined to show its validity. Syntax errors are highlighted in red, too. There are other attributes for e.g. different file types or regular expressions, and of course you con adjust them to fit your needs.
  2. TAB completion is an essential feature when working in the shell, and it’s a part where fish really shines. Of course it completes all commands in PATH and directories/files, but it completes the options and switches of a command, too. For example it knows that the darcs command has the subcommands add, ..., whatsnew, and it knows the switches of those subcommands. Beside completing those subcommands and switches, it displays a short description, so the user can exploit the completion mechanism to explore what a command can do. The best thing is: All those completions are fish scripts utilizing the complete command. So if there’s no completion for the foobar command, you can easily write one yourself (and submit it to the fish ML to share it with the other users).
  3. Fish uses Emacs keybindings, so an emacs user will find it very comfortable. It even has a kill ring!
  4. The command history is awesome. If you press the up and down arrows, you walk accross the command history like in BASH. But if you enter a string at the prompt first, then fish shows only commands that match the entered string. If you use M-Up/M-Down the history commands are tokenized, so you can complete arguments this way.
  5. There’s an open command which open the given file with the application chosen in the desktop environment’s MIME database.

Beside those mentioned features, fish has a lot of other nice capabilities. So here’s my advice: TRY IT and join us at #fish at irc.oftc.net.