134 lines
4.0 KiB
Cheetah
134 lines
4.0 KiB
Cheetah
# Directly start sway if we're on tty1
|
|
if [ "$(tty)" = "/dev/tty1" ]; then
|
|
exec sway-run
|
|
fi
|
|
|
|
# Back out if we're surrounded by Emacs
|
|
[ "$TERM" = "eterm-color" ] && exec bash
|
|
[ "$TERM" = "xterm-termite" ] && export TERM=xterm-256color
|
|
|
|
# Back out if we are in a Emacs tramp session
|
|
if [[ $TERM == "eterm-color " ]] || [[ $TERM == "dumb" ]]; then
|
|
unsetopt zle
|
|
PS1='$ '
|
|
return
|
|
fi
|
|
|
|
plugins=(fzf fasd dotenv tmuxinator)
|
|
fpath=( ~/.kubectx/completion "${fpath[@]}" )
|
|
|
|
ZSH_CUSTOM="${HOME}/.zsh-custom"
|
|
{{- if eq .chezmoi.fullHostname "mcnaught.uberspace.de" }}
|
|
ZSH_THEME="jreese"
|
|
{{ else }}
|
|
ZSH_THEME="powerlevel10k/powerlevel10k"
|
|
{{- end }}
|
|
ZSH_DOTENV_FILE=".direnv"
|
|
FZF_MARKS_FILE="${HOME}/.config/fzf/${HOST}"
|
|
|
|
export ZSH=/home/bascht/.oh-my-zsh
|
|
export DISABLE_AUTO_UPDATE="true"
|
|
|
|
source $ZSH/oh-my-zsh.sh
|
|
source $ZSH_CUSTOM/plugins/fzf-marks/fzf-marks.plugin.zsh
|
|
|
|
alias va="vagrant"
|
|
alias bi="bundle install"
|
|
alias be="bundle exec"
|
|
alias ber="bundle exec rake"
|
|
alias e=$EDITOR
|
|
alias ssh-yop="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
|
alias docker-rm-stopped="docker rm (docker ps -a -q)"
|
|
alias docker-rm-dangling="docker rmi (docker images -q -f dangling=true)"
|
|
alias dco="docker-compose"
|
|
alias dcorrm="docker-compose run --rm"
|
|
alias emacseval="emacs -batch -l ~/.emacs.d/init.el -eval '(org-batch-agenda "a")'"
|
|
alias drri="docker run --rm -ti"
|
|
alias dry="drri -v /var/run/docker.sock:/var/run/docker.sock skanehira/docui"
|
|
alias k=kubectl
|
|
alias kgp="kubectl get pods"
|
|
alias krs="kubectl rollout status"
|
|
alias g=git
|
|
alias gpr="git pull -r"
|
|
alias git-cleanup-merged-branches="git fetch -va && git branch --merged | egrep -v '(^\*|master)' | xargs git branch -d"
|
|
alias wttr="curl 'wttr.in/Bogenhausen?1pQF&lang=de'"
|
|
alias termbin="nc termbin.com 9999"
|
|
alias ssh='TERM=xterm-256color ssh'
|
|
alias sudo='TERM=xterm-256color sudo'
|
|
alias gp="gopass"
|
|
alias hl="hledger"
|
|
alias cm="chezmoi"
|
|
alias cm-private="chezmoi -S ~/.local/share/chezmoi-private"
|
|
alias kn="kubens"
|
|
|
|
# Global Aliases
|
|
alias -g B="|bat"
|
|
alias -g baml="|bat -l yaml"
|
|
|
|
# Switch between multiple kubeconfigs, stored in gopass
|
|
kp() { export KUBECONFIG=/dev/shm/kubeconfig && gopass $(gopass ls -f | fzf --query "'${1} kubeconfig" --select-1) > $KUBECONFIG && source <(kubectl completion zsh) }
|
|
|
|
timestamp() { date +%Y-%m-%d-%H%M%S }
|
|
letterup() { take $1 && cp -a ~/Documents/Personal/Brief-Vorlage/2017-LaTeX/* .; }
|
|
|
|
# Pretty up FZF
|
|
export FZF_DEFAULT_OPTS='
|
|
--prompt=" "
|
|
--color=bg+:#f0f0f1,bg:#fafafa,spinner:#0184bc,hl:#4078f2
|
|
--color=fg:#696c77,header:#4078f2,info:#c18401,pointer:#0184bc
|
|
--color=marker:#0184bc,fg+:#202227,prompt:#c18401,hl+:#4078f2
|
|
'
|
|
#source /usr/share/zsh/site-functions/tmuxinator.zsh
|
|
|
|
# Via @dohq
|
|
# https://gist.github.com/dohq/1dc702cc0b46eb62884515ea52330d60
|
|
function fzf-ssh () {
|
|
local selected_host=$(grep "Host " ~/.ssh/config | grep -v '*' | cut -b 6- | fzf --reverse --height=20 --query "$LBUFFER")
|
|
|
|
if [ -n "$selected_host" ]; then
|
|
BUFFER="ssh ${selected_host}"
|
|
zle accept-line
|
|
fi
|
|
zle reset-prompt
|
|
}
|
|
|
|
# Only load kubectl completion when needed. I's bog-slow
|
|
if [[ -f $KUBECONFIG ]]; then
|
|
source <(kubectl completion zsh);
|
|
fi;
|
|
|
|
zle -N fzf-ssh
|
|
bindkey '\es' fzf-ssh
|
|
|
|
function fzf-vm () {
|
|
local selected_vm=$(grep "Host " ~/.ssh/config | grep -oP "vm-(\w+)" | sort -u | cut -b 4- | fzf --reverse --height=20 --query "$LBUFFER")
|
|
if [ -n "$selected_vm" ]; then
|
|
BUFFER="vm ${selected_vm} ''"
|
|
zle accept-line
|
|
fi
|
|
zle reset-prompt
|
|
}
|
|
zle -N fzf-vm
|
|
bindkey '\ev' fzf-vm
|
|
|
|
function ta () {
|
|
tmux attach $(tmux ls -F "#{session_name}" | fzf)
|
|
}
|
|
|
|
# Via @leahneukirchen
|
|
autoload -Uz copy-earlier-word
|
|
zle -N copy-earlier-word
|
|
bindkey "^[m" copy-earlier-word
|
|
|
|
if [ -f ~/Code/architecture/bin/ia ]; then
|
|
source <(~/Code/architecture/bin/ia completion)
|
|
fi;
|
|
|
|
if [ -f /home/bascht/Code/infrastructure-cli/Rakefile ]; then
|
|
alias chuck="rake -f /home/bascht/Code/infrastructure-cli/Rakefile"
|
|
fi;
|
|
|
|
source ~/.zsh-custom/plugins/
|
|
source ~/.p10k.zsh
|
|
autoload -U compinit && compinit
|