# z shell configuration OSICON="?" # set prompt icon if [ -e /System ]; then OSICON="" eval "$(/opt/homebrew/bin/brew shellenv)" else . /etc/os-release &> /dev/null if [ "$ID" = "nixos" ]; then OSICON="" elif [ "$ID" = "debian" ]; then OSICON="" elif [ "$ID" = "fedora" ]; then OSICON="󰣇" elif [ "$ID" = "arch" ]; then OSICON="" fi fi # set prompt colours HOSTNAME="$(hostname)" if [ "$HOSTNAME" = "kita" ]; then PRIMARY_COLOUR="{red}" SECONDARY_COLOUR="{yellow}" TEXT_COLOUR="{black}" elif [ "$HOSTNAME" = "bocchi" ]; then PRIMARY_COLOUR="{magenta}" SECONDARY_COLOUR="{white}" TEXT_COLOUR="{black}" elif [ "$HOSTNAME" = "ryo" ]; then PRIMARY_COLOUR="{cyan}" SECONDARY_COLOUR="{blue}" TEXT_COLOUR="{black}" elif [ "$HOSTNAME" = "nijika" ]; then PRIMARY_COLOUR="{yellow}" SECONDARY_COLOUR="{green}" TEXT_COLOUR="{black}" else PRIMARY_COLOUR="{blue}" SECONDARY_COLOUR="{red}" TEXT_COLOUR="{black}" fi PROMPT="%K$PRIMARY_COLOUR%F$TEXT_COLOUR %~ %K$SECONDARY_COLOUR $OSICON %k%F{white} " RPROMPT="%F{7}$HOSTNAME" bindkey -e # zstyles zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" zstyle ':completion:*' menu no # hist HISTFILE="$HOME/.local/share/zsh_hist" HISTSIZE=10000000 SAVEHIST=$HISTSIZE setopt appendhistory setopt sharehistory setopt hist_save_no_dups setopt hist_ignore_all_dups setopt hist_find_no_dups setopt hist_ignore_space # shell alias alias ls="ls -h --color=auto" alias la="ls -ah --color=auto" alias ll="ls -ahl --color=auto" alias cat="bat" alias rm="trash" alias ssh="TERM=xterm-256color ssh" # fix ssh not recognising terminal and remote shell being somewhat broken alias tmux="tmux -f $HOME/.config/tmux/tmux.conf" # needed for osx systems for some reason # env vars export GOPATH="$HOME/.local/share/go" export PATH="$PATH:$GOPATH/bin" export EDITOR="nvim" # functions func calc() { # why isn't this in bash by default # if command -v python3 > /dev/null; then python3 -c "print($1)" else echo "python3 needs to be installed for this to work!" fi } func 0x0() { if [ -d "$1" ]; then TMPFILE="$(mktemp)" tar cf "$TMPFILE" "$1" curl -F file=@$TMPFILE -F expires=24 https://0x0.st else curl -F file=@$1 -F expires=24 https://0x0.st fi } # plugins plugindir="$HOME/.local/share/zsh_plug" func plugInstall() { # clones a repo and then sources it. # first arg is git url, second is source # location foldername=$(basename $1) clonepath="$plugindir/$foldername" sourcefile="$clonepath/$2" if command -v git > /dev/null && [ ! -d "$clonepath" ]; then git clone $1 "$clonepath" --depth=1 fi if [ -f "$sourcefile" ]; then source "$sourcefile" fi } plugInstall https://github.com/zsh-users/zsh-syntax-highlighting zsh-syntax-highlighting.zsh plugInstall https://github.com/Aloxaf/fzf-tab fzf-tab.zsh # load fzf and zoxide eval "$(fzf --zsh)" eval "$(zoxide init zsh)"