2022-02-10 20:11:56 +01:00
|
|
|
#--------------------------------
|
|
|
|
# filename: /zshrc
|
|
|
|
#--------------------------------
|
|
|
|
|
|
|
|
autoload -Uz promptinit && promptinit
|
|
|
|
autoload -U compinit && compinit
|
|
|
|
|
2022-02-14 21:43:08 +01:00
|
|
|
# Prompt color
|
2022-02-14 22:11:07 +01:00
|
|
|
prompt_color1="#ffaf00"
|
2022-09-02 19:32:26 +02:00
|
|
|
prompt_color2="#000000"
|
2022-02-10 20:11:56 +01:00
|
|
|
|
|
|
|
# Load zsh settings
|
2022-11-13 19:19:00 +01:00
|
|
|
source "$HOME/.dotfiles/zsh/settings"
|
2022-02-10 20:11:56 +01:00
|
|
|
|
2024-08-10 19:34:07 +02:00
|
|
|
# Run command when connected via SSH
|
2024-08-10 19:36:57 +02:00
|
|
|
# via: https://stackoverflow.com/questions/27613209/how-to-automatically-start-tmux-on-ssh-session/40192494#40192494
|
|
|
|
#
|
2024-08-10 19:34:07 +02:00
|
|
|
if [[ $- =~ i ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_TTY" ]]; then
|
|
|
|
tmux attach-session -t default || tmux new-session -s default
|
2024-08-11 01:37:12 +02:00
|
|
|
exit
|
2024-08-10 19:34:07 +02:00
|
|
|
fi
|
|
|
|
|
2022-02-10 20:11:56 +01:00
|
|
|
# Define platform
|
|
|
|
platform='Unknown'
|
|
|
|
if [[ $(uname) == 'Linux' ]]; then
|
2024-07-05 10:33:12 +02:00
|
|
|
platform='Linux'
|
2022-02-10 20:11:56 +01:00
|
|
|
elif [[ $(uname) == 'Darwin' ]]; then
|
2024-07-05 10:33:12 +02:00
|
|
|
platform='macOS'
|
2022-02-10 20:11:56 +01:00
|
|
|
fi
|
2022-02-20 17:38:48 +01:00
|
|
|
|
|
|
|
# Define CPU architecture
|
2022-02-10 20:11:56 +01:00
|
|
|
arch='Unknown'
|
|
|
|
if [[ $(uname -p) == 'arm' ]]; then
|
|
|
|
arch="arm"
|
|
|
|
elif [[ $(uname -p) == 'i386' ]]; then
|
|
|
|
arch="i386"
|
|
|
|
elif [[ $(uname -p) == 'x86_64' ]]; then
|
|
|
|
arch="x86_64"
|
|
|
|
fi
|
|
|
|
|
2022-02-20 17:39:39 +01:00
|
|
|
# Homebrew
|
|
|
|
homebrew_path=""
|
|
|
|
if test -f "/opt/homebrew/bin/brew"; then
|
|
|
|
homebrew_path="/opt/homebrew/bin"
|
|
|
|
homebrew_opt="/opt/homebrew/opt"
|
|
|
|
elif test -f "/usr/local/bin/brew"; then
|
2022-02-20 17:58:58 +01:00
|
|
|
homebrew_path="/usr/local/bin"
|
|
|
|
homebrew_opt="/usr/local/opt"
|
2022-02-20 17:39:39 +01:00
|
|
|
fi
|
|
|
|
|
2022-02-10 20:11:56 +01:00
|
|
|
# Load additional settings
|
2022-11-13 19:19:00 +01:00
|
|
|
source "$HOME/.dotfiles/zsh/env"
|
|
|
|
source "$HOME/.dotfiles/zsh/alias"
|
|
|
|
source "$HOME/.dotfiles/zsh/bindings"
|
|
|
|
source "$HOME/.dotfiles/zsh/scripts"
|
|
|
|
source "$HOME/.dotfiles/zsh/ffmpeg"
|
|
|
|
source "$HOME/.dotfiles/this-machine/zsh"
|
2022-02-10 20:11:56 +01:00
|
|
|
|
2022-02-14 21:43:08 +01:00
|
|
|
# Prompt design
|
2023-06-15 17:59:24 +02:00
|
|
|
prompt="%F{$prompt_color2}%K{$prompt_color1}▓▒░ %F%B%n@%m%b%F{$prompt_color1}%K{$prompt_color2}█▓▒░%F{#ffffff}%K{$prompt_color2}%B %D{%Y-%m-%d} %D{%k:%M:%S}
|
2022-02-14 22:11:07 +01:00
|
|
|
%}%F{$prompt_color1}%K{$prompt_color2}%B%~/%b%k%f "
|
2022-02-14 21:43:08 +01:00
|
|
|
|
2022-02-10 21:15:29 +01:00
|
|
|
# Load private information from second repo
|
|
|
|
if [[ -d $HOME/.jan ]]; then
|
2022-11-13 19:19:00 +01:00
|
|
|
source "$HOME/.jan/credentials"
|
|
|
|
source "$HOME/.jan/zsh_options"
|
2022-02-10 20:11:56 +01:00
|
|
|
fi
|