Why Use Fish?

In the previous post, I provided instructions to switch your default shell from Zsh to Fish. Fish offers many great features and benefits, which you can explore in that post.

Overview

To integrate Fish with Visual Studio Code (VS Code), follow these steps:

  1. Install Fish (of course!).
  2. Set Fish as the default shell.
  3. Configure VS Code to use Fish as the default shell for the integrated terminal.
  4. Restart VS Code to apply the changes.

Issues

By default, if Fish is already set as the default shell, VS Code detects it and integrates it with the terminal. Just ensure the Terminal > Integrated > Default Profile: OS X option is set to null (default).

terminal-integrated-setting

In my case (VS Code 1.95.3), the default setting didn’t work. After restarting, VS Code still used Zsh as the default shell in the integrated terminal. If you encounter the same issue, you can manually set up Fish as the default shell for the integrated terminal as follows:

  1. Get the full path to your Fish installation:

    $ which fish
    /opt/homebrew/bin/fish
    

    If you encounter path errors after setting Fish as the default shell, add the following line to your ~/.config/fish/config.fish file:

    set -x PATH /usr/local/bin /opt/homebrew/bin $PATH
    
  2. Add a Fish profile:

    terminal.integrated.profiles.osx

    Open Settings (Cmd + ,), navigate to terminal.integrated.profiles.osx, then click Edit in settings.json, and paste the following code:

    "fish": {
      "path": "/opt/homebrew/bin/fish",
      "args": [
        "-l"
      ]
    }
    

    Make sure to specify the full path to your Fish installation in the path field.

    After saving these settings, the dropdown menu next to the + icon in the Panel will display fish.

  3. Set Fish as the default profile:

    Use the dropdown menu to select “Select Default Profile,” then choose fish as the default.

    set default profile

More…

You can enhance your experience with the VS Code Fish extension, which provides features such as code linting, formatting, snippets, and keybindings.