Archived
1
0
Fork 0
This repository has been archived on 2024-06-19. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/files/.zshrc

168 lines
3.7 KiB
Bash
Raw Normal View History

#
# ~/.zshrc
#
# If not running interactively, do nothing
[[ $- != *i* ]] && return
export PATH="$HOME/.yarn/bin:$HOME/.cargo/bin:$HOME/.local/bin:$PATH"
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
copybuffer
docker
docker-compose
git
git-extras
per-directory-history
ripgrep
rustup
safe-paste
sudo
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
SPACESHIP_TIME_SHOW=true
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
export EDITOR=amp
export GIT_EDITOR=$EDITOR
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
export PATH="$GEM_HOME/bin:$PATH"
2020-02-11 23:52:22 +01:00
# Golang
export GOPATH=$HOME/.go
export PATH="$GOPATH/bin:$PATH"
export GPG_TTY=$(tty)
export WINEARCH=win32
2020-02-11 23:52:22 +01:00
export DEVKITPRO=/opt/devkitpro
export DEVKITARM=$DEVKITPRO/devkitARM
export DEVKITPPC=$DEVKITPRO/devkitPPC
# export PATH="${DEVKITPPC}/bin:${DEVKITARM}/bin:${DEVKITPRO}/tools/bin:$PATH"
2020-02-11 23:52:22 +01:00
export PATH="$HOME/cross/bin:$PATH"
2020-06-08 23:42:09 +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
# Do not share history
unsetopt share_history
# Disable annoying correction prompt
unsetopt correct_all
alias yt-dl-mp3="youtube-dl -o '%(title)s.%(ext)s' -i -x --audio-quality 320K --audio-format mp3"
alias yt-dl-video="youtube-dl -iw -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best'"
alias weather='curl wttr.in'
2020-10-26 14:28:57 +01:00
alias diff='diff -u -p -r -N --color=auto'
alias valgrind-full-check='valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes'
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
}
gen-rsa-keypair() {
openssl genpkey -algorithm RSA -out "$1" -pkeyopt rsa_keygen_bits:4096
openssl rsa -pubout -in "$1" -out "$1.pub"
}
source $HOME/.zsh_platform
__update_log() {
printf "\n 📦 \e[92mUpdating $1\e[0m\n"
}
__update_git_repo() {
pushd "$1"
git pull
popd
}
update() {
setopt pushdsilent
__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
__update_log 'oh-my-zsh'
omz update
2021-04-14 02:50:38 +02:00
__update_log 'oh-my-zsh extra stuff'
__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
}