All notes tagged with fish.

December 5, 2024

fish shell

Make and jump into directory easily

Very often - like ALL the time - you end up creating a new directory with mkdir -p some_path and then immediately typing cd some_path right after. Such a waste of typing!

Here’s a super handy little function that does both things at once. Just drop this in your config and thank me later:

For Fish:

function mkcd
    mkdir -p $argv[1]; and cd $argv[1]
end

For those that have to still learn that Fish is the best shell, here’s Bash and ZSH:

mkcd() {
    mkdir -p "$1" && cd "$1"
}

Now you can just type mkcd ~/.config/test and boom - directory created and you’re already inside it! The -p flag means it’ll create any missing parent directories too, so you can go as deep as you want. Way better than typing two commands every single time, right?

May 20, 2023

fish mac

Setting up Fish on the Mac

Fish shell is my shell of choice and having it setup as default on the Mac requires some extra steps.

When homebrew is installed, run brew install fish.

After that, edit /etc/shells and add fish to it:

# sudo edit /etc/shells

Add the bottom of the file add:

/opt/homebrew/bin/fish

Then set the shell as default with:

chsh -s /opt/homebrew/bin/fish

It does require logging again to be activated.

January 2, 2022

command-line fish