fish

Start my Fish shell always from home, rather than the previous location?


I use the Fish shell, using the config from this dotfiles repository: https://github.com/kevinrenskers/dotfiles/tree/main/fish.

The problem is that whenever I open a new tab in my terminal, that it starts off from the previous path, instead of from my user's home folder. How can I change this behavior so that every terminal always opens from ~?

The weird thing is that I've been using these dotfiles for forever and I never had this problem until I formatted my computer and set it up from scratch. No idea why now it behaves like this, but I really don't like it.


Solution

  • The solution is to update your config.fish file

    # all your actual command
    
    # Start in home directory
    cd ~
    

    By adding the cd ~ at the end of your config file, it'll be excecuted everytime you open a new fish instance as the last command.

    You can change the ~ with any path where you want to start from but the ~ is for home.

    It's similar to a .bashrc or a .zshrc only the name change