if status is-login
    # Utilities
    if type -q nvim
        set --global --export EDITOR "nvim"
    else if type -q vim
        set --global --export EDITOR "vim"
    end
    set --global --export PAGER "less"
    type -q kitty && set --global --export TERMINAL "kitty"

    # Path
    function add_path
        set --function bin_path "$argv[1]"
        if test -d "$bin_path"
            if not contains "$bin_path" $PATH
                set --global --export PATH "$bin_path" $PATH
            end
        end
    end
    add_path "$HOME/.local/bin"
    add_path "$HOME/.cargo/bin"

    # SSH agent
    # Enable it using `systemctl enable --user ssh-agent.service`
    begin
        set --local ssh_agent_socket "$XDG_RUNTIME_DIR/ssh-agent.socket"
        test -S "$ssh_agent_socket" && set --global --export SSH_AUTH_SOCK "$ssh_agent_socket"
    end

    # XDG
    set --global --export XDG_USER_DIR_FILE "$HOME/.config/user-dirs.dirs"
    set --global --export XDG_DESKTOP_DIR "$HOME/desktop"
    set --global --export XDG_DOWNLOAD_DIR "$HOME/downloads"
    set --global --export XDG_TEMPLATES_DIR "$HOME/templates"
    set --global --export XDG_PUBLICSHARE_DIR "$HOME/public_share"
    set --global --export XDG_DOCUMENTS_DIR "$HOME/documents"
    set --global --export XDG_MUSIC_DIR "$HOME/music"
    set --global --export XDG_PICTURES_DIR "$HOME/pictures"
    set --global --export XDG_VIDEOS_DIR "$HOME/videos"

    # Java
    # https://wiki.archlinux.org/title/Java#Switching_between_JVM
    set --global --export JAVA_HOME "/usr/lib/jvm/default"
end

if status is-interactive
    # Disable the Fish greeting message
    set --global fish_greeting

    # zoxide
    zoxide init fish | source
end