2018-09-25 10:29:29 +02:00
|
|
|
#
|
|
|
|
# ~/.zshrc
|
|
|
|
#
|
|
|
|
|
|
|
|
# If not running interactively, do nothing
|
|
|
|
[[ $- != *i* ]] && return
|
|
|
|
|
2020-11-13 19:31:56 +01:00
|
|
|
export PATH="$HOME/.yarn/bin:$HOME/.cargo/bin:$HOME/.local/bin:$PATH"
|
2018-09-25 10:29:29 +02:00
|
|
|
export ZSH=$HOME/.oh-my-zsh
|
|
|
|
|
|
|
|
ZSH_THEME=spaceship
|
|
|
|
HYPHEN_INSENSITIVE=true
|
|
|
|
ENABLE_CORRECTION=true
|
|
|
|
|
|
|
|
# Display red dots whilst waiting for completion
|
|
|
|
COMPLETION_WAITING_DOTS=true
|
|
|
|
|
|
|
|
# Timestamps for history
|
|
|
|
HIST_STAMPS=yyyy-mm-dd
|
|
|
|
|
|
|
|
plugins=(
|
2019-05-09 21:52:26 +02:00
|
|
|
cargo
|
|
|
|
colored-man-pages
|
2021-05-15 00:06:43 +02:00
|
|
|
copybuffer
|
2018-09-25 10:29:29 +02:00
|
|
|
docker
|
2019-07-02 15:59:45 +02:00
|
|
|
docker-compose
|
2019-05-08 22:17:34 +02:00
|
|
|
git
|
2018-09-25 10:29:29 +02:00
|
|
|
git-extras
|
2021-05-15 00:06:43 +02:00
|
|
|
per-directory-history
|
|
|
|
ripgrep
|
|
|
|
rustup
|
|
|
|
safe-paste
|
2019-07-02 15:59:45 +02:00
|
|
|
sudo
|
2018-09-25 10:29:29 +02:00
|
|
|
z
|
|
|
|
|
|
|
|
# must be last
|
|
|
|
zsh-syntax-highlighting
|
|
|
|
)
|
|
|
|
|
|
|
|
source $ZSH/oh-my-zsh.sh
|
|
|
|
|
|
|
|
# Show low battery warning < 20% left
|
|
|
|
SPACESHIP_BATTERY_THRESHOLD=20
|
|
|
|
|
|
|
|
# Show execution time of last command if > 10 sec
|
|
|
|
SPACESHIP_EXEC_TIME_ELAPSED=10
|
|
|
|
|
|
|
|
SPACESHIP_EXIT_CODE_SYMBOL="✘ "
|
|
|
|
SPACESHIP_EXIT_CODE_SHOW=true
|
2020-02-12 15:59:34 +01:00
|
|
|
SPACESHIP_TIME_SHOW=true
|
2018-09-25 10:29:29 +02:00
|
|
|
|
|
|
|
export MANPATH="/usr/local/man:$MANPATH"
|
|
|
|
|
|
|
|
export LANG=en_US.UTF-8
|
|
|
|
export LC_ALL=$LANG
|
|
|
|
|
|
|
|
export HISTCONTROL=ignoreboth
|
|
|
|
export HISTSIZE=10000
|
|
|
|
export HISTFILESIZE=$HISTSIZE
|
|
|
|
|
2021-01-03 21:08:12 +01:00
|
|
|
export EDITOR=amp
|
2018-09-25 10:29:29 +02:00
|
|
|
export GIT_EDITOR=$EDITOR
|
2020-11-13 19:31:56 +01:00
|
|
|
export PKG_CONFIG_PATH="$HOME/.local/lib/pkgconfig:$HOME/.local/share/pkgconfig:/usr/local/lib/pkgconfig"
|
2020-02-11 23:52:22 +01:00
|
|
|
export GEM_HOME=$HOME/.gem
|
2020-11-13 19:31:56 +01:00
|
|
|
export PATH="$GEM_HOME/bin:$PATH"
|
2020-02-11 23:52:22 +01:00
|
|
|
|
|
|
|
# Golang
|
|
|
|
export GOPATH=$HOME/.go
|
2020-11-13 19:31:56 +01:00
|
|
|
export PATH="$GOPATH/bin:$PATH"
|
2018-09-25 10:29:29 +02:00
|
|
|
|
2019-02-11 10:30:22 +01:00
|
|
|
export GPG_TTY=$(tty)
|
2019-07-21 16:57:55 +02:00
|
|
|
export WINEARCH=win32
|
2018-09-25 10:29:29 +02:00
|
|
|
|
2020-02-11 23:52:22 +01:00
|
|
|
export DEVKITPRO=/opt/devkitpro
|
2020-11-19 01:46:21 +01:00
|
|
|
export DEVKITARM=$DEVKITPRO/devkitARM
|
|
|
|
export DEVKITPPC=$DEVKITPRO/devkitPPC
|
2020-11-13 19:31:56 +01:00
|
|
|
# export PATH="${DEVKITPPC}/bin:${DEVKITARM}/bin:${DEVKITPRO}/tools/bin:$PATH"
|
2020-02-11 23:52:22 +01:00
|
|
|
|
2020-11-13 19:31:56 +01:00
|
|
|
export PATH="$HOME/cross/bin:$PATH"
|
2020-06-08 23:42:09 +02:00
|
|
|
|
2018-09-25 10:29:29 +02:00
|
|
|
# Setup base16 themes
|
|
|
|
export BASE16_SHELL=$HOME/.config/base16-shell
|
|
|
|
[ -n "$PS1" ] && [ -s $BASE16_SHELL/profile_helper.sh ] && eval "$($BASE16_SHELL/profile_helper.sh)"
|
|
|
|
|
|
|
|
# Setup nvm
|
|
|
|
export NVM_DIR=$HOME/.nvm
|
|
|
|
[ -s $NVM_DIR/nvm.sh ] && source $NVM_DIR/nvm.sh
|
|
|
|
|
|
|
|
# Do not freeze terminal on Ctrl-S
|
|
|
|
stty -ixon
|
|
|
|
|
2019-07-02 15:59:45 +02:00
|
|
|
# Do not share history
|
|
|
|
unsetopt share_history
|
|
|
|
|
2020-02-12 15:59:34 +01:00
|
|
|
# Disable annoying correction prompt
|
|
|
|
unsetopt correct_all
|
|
|
|
|
2020-06-01 13:03:52 +02:00
|
|
|
alias yt-dl-mp3="youtube-dl -o '%(title)s.%(ext)s' -i -x --audio-quality 320K --audio-format mp3"
|
2020-11-20 17:57:06 +01:00
|
|
|
alias yt-dl-video="youtube-dl -iw -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best'"
|
2018-09-25 10:29:29 +02:00
|
|
|
alias weather='curl wttr.in'
|
2020-10-26 14:28:57 +01:00
|
|
|
alias diff='diff -u -p -r -N --color=auto'
|
2020-11-19 01:47:09 +01:00
|
|
|
alias valgrind-full-check='valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes'
|
2019-09-16 10:49:09 +02:00
|
|
|
alias gcan!='git commit --amend --date now --reset-author'
|
|
|
|
|
2019-07-03 12:59:00 +02:00
|
|
|
git-check-merge() {
|
2019-08-02 18:16:46 +02:00
|
|
|
local output="$(git merge $1 --no-ff --no-commit 2>&1)"
|
|
|
|
|
|
|
|
if [[ "$output" == *"merge failed"* ]]; then
|
|
|
|
echo "$output" | grep CONFLICT 2>/dev/null
|
|
|
|
echo "Automatic merge failed" 2>/dev/null
|
|
|
|
else
|
|
|
|
echo "Automatic merge went well"
|
|
|
|
fi
|
|
|
|
|
2019-07-03 12:59:00 +02:00
|
|
|
git merge --abort # Return to previous state
|
|
|
|
}
|
|
|
|
|
2019-07-19 11:23:00 +02:00
|
|
|
gen-rsa-keypair() {
|
|
|
|
openssl genpkey -algorithm RSA -out "$1" -pkeyopt rsa_keygen_bits:4096
|
|
|
|
openssl rsa -pubout -in "$1" -out "$1.pub"
|
|
|
|
}
|
|
|
|
|
2018-09-25 10:29:29 +02:00
|
|
|
source $HOME/.zsh_platform
|
|
|
|
|
|
|
|
__update_log() {
|
|
|
|
printf "\n 📦 \e[92mUpdating $1\e[0m\n"
|
|
|
|
}
|
|
|
|
|
2021-03-11 08:41:10 +01:00
|
|
|
__update_git_repo() {
|
|
|
|
pushd "$1"
|
2019-07-21 16:57:55 +02:00
|
|
|
git pull
|
|
|
|
popd
|
|
|
|
}
|
2018-09-25 10:29:29 +02:00
|
|
|
|
|
|
|
update() {
|
2021-03-11 08:41:10 +01:00
|
|
|
setopt pushdsilent
|
|
|
|
|
2018-09-25 10:29:29 +02:00
|
|
|
__update_log 'system packages'
|
|
|
|
update_platform
|
|
|
|
|
|
|
|
if hash yarn 2> /dev/null; then
|
|
|
|
__update_log 'global node packages'
|
|
|
|
yarn global upgrade
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if hash gem 2> /dev/null; then
|
|
|
|
__update_log gems
|
|
|
|
gem update
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if hash rustup 2> /dev/null; then
|
|
|
|
__update_log rust
|
|
|
|
rustup update
|
|
|
|
fi
|
2019-07-21 16:57:55 +02:00
|
|
|
|
2020-11-30 12:22:43 +01:00
|
|
|
__update_log 'oh-my-zsh'
|
|
|
|
omz update
|
|
|
|
|
2021-04-14 02:50:38 +02:00
|
|
|
__update_log 'oh-my-zsh extra stuff'
|
2021-03-11 08:41:10 +01:00
|
|
|
__update_git_repo "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting"
|
|
|
|
__update_git_repo "$ZSH_CUSTOM/themes/spaceship-prompt"
|
|
|
|
__update_git_repo "$HOME/.config/base16-shell"
|
|
|
|
|
|
|
|
unsetopt pushdsilent
|
2018-09-25 10:29:29 +02:00
|
|
|
}
|