ansible-role-common/templates/_zshrc.j2
2024-11-28 19:35:07 +01:00

152 lines
4.3 KiB
Django/Jinja

# Unified zshrc of Jannik Beyerstedt
export TERM=xterm-256color
{% if usersetup_virtualenvwrapper|default(false)|bool %}
VIRTUALENVWRAPPER_PYTHON=$(which python3)
{% endif %}
DEFAULT_USER="jannik"
DISABLE_UPDATE_PROMPT=true
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
ZSH_THEME="jtbx"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Case sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Oh-my-zsh Update settings
DISABLE_AUTO_UPDATE="true"
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# This makes repository status check for large repositories much, much faster.
DISABLE_UNTRACKED_FILES_DIRTY="true"
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
HIST_STAMPS="yyyy-mm-dd"
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(
git
docker
docker-compose
fzf
pip
{% if usersetup_virtualenvwrapper|default(false)|bool %}
virtualenvwrapper
{% endif %}
)
source $ZSH/oh-my-zsh.sh
# User configuration
if [ "$(uname)" != "Darwin" ]; then
export LANG="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
export LC_NUMERIC="de_DE.UTF-8"
export LC_TIME="de_DE.UTF-8"
export LC_COLLATE="de_DE.UTF-8"
export LC_MONETARY="de_DE.UTF-8"
export LC_MESSAGES="en_US.UTF-8"
export LC_PAPER="de_DE.UTF-8"
export LC_NAME="de_DE.UTF-8"
export LC_ADDRESS="de_DE.UTF-8"
export LC_TELEPHONE="de_DE.UTF-8"
export LC_MEASUREMENT="de_DE.UTF-8"
else
export LANG="en_US.UTF-8"
fi
setopt share_history
# load host specific settings
[[ -f "$HOME/.zshrc-host" ]] && source $HOME/.zshrc-host
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
alias pip3-upgrade="pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U"
alias pip3-list-updates="pip3 list --outdated"
alias rsync-copy="rsync -avz --info=progress2 --partial -h"
alias rsync-move="rsync -avz --info=progress2 -h --remove-source-files"
alias rsync-update="rsync -avzu --info=progress2 --partial -h"
alias rsync-synchronize="rsync -avzu --delete --info=progress2 --partial -h"
# stolen from: https://eldritch.cafe/@lexi/103707492979358755
alias doch='sudo sh -c "$(fc -n -l -- -1)"'
# more git helpers
alias git-reset-pull='git fetch && git reset --hard origin/$(git rev-parse --abbrev-ref HEAD)'
alias git-force-push='git push origin $(git rev-parse --abbrev-ref HEAD) --force-with-lease'
git_retag() {
# delete specified tag, add to current HEAD again and push
remote="origin"
if [ "$#" -ge "2" ]; then
remote=$2;
fi
if [ "$#" -ge "1" ]; then
git tag -d $1 && git push $remote :$1 && git tag $1 && git push $remote $1
else
echo "ERROR: Please provide a tag name and optionally a remote name (default = 'origin')"
fi
}
# mpv
alias mpv="mpv --autofit=70%"
# stolen from: https://fem.social/@clerie/110275008064297220
alias nmap-fast-ping='nmap -n --disable-arp-ping -sn $@'
# ffmpeg shortcuts
ffmpeg_compress() {
if [ -n "$1" ]; then
filename=$1:r
fileext=$1:e
ffmpeg -i $1 -c:v libx264 -preset slow -crf 28 $filename-comp.mp4
else
echo "ERROR: Please provide a file name"
fi
}
ffmpeg_reencode() {
if [ -n "$1" ]; then
filename=$1:r
fileext=$1:e
if [[ $(uname) == "Darwin" ]]; then
ffmpeg -i $1 -c:v h264_videotoolbox -b:v 6000k $filename-reenc.mp4
else
ffmpeg -i $1 $filename-reenc.mp4
fi
else
echo "ERROR: Please provide a file name"
fi
}