2019-10-14 17:30:02 +02:00
|
|
|
# Directly start sway if we're on tty1
|
|
|
|
if [ "$(tty)" = "/dev/tty1" ]; then
|
2019-10-18 16:43:44 +02:00
|
|
|
exec sway-run
|
2019-10-14 17:30:02 +02:00
|
|
|
fi
|
|
|
|
|
2020-06-22 16:34:40 +02:00
|
|
|
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
|
|
|
|
# Initialization code that may require console input (password prompts, [y/n]
|
|
|
|
# confirmations, etc.) must go above this block, everything else may go below.
|
|
|
|
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
|
|
|
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
|
|
|
|
fi
|
|
|
|
|
2018-02-14 11:19:39 +01:00
|
|
|
# Back out if we're surrounded by Emacs
|
|
|
|
[ "$TERM" = "eterm-color" ] && exec bash
|
2019-07-30 23:54:50 +02:00
|
|
|
[ "$TERM" = "xterm-termite" ] && export TERM=xterm-256color
|
2018-02-14 11:19:39 +01:00
|
|
|
|
2019-03-07 11:28:43 +01:00
|
|
|
# Back out if we are in a Emacs tramp session
|
2019-07-30 23:54:50 +02:00
|
|
|
if [[ $TERM == "eterm-color " ]] || [[ $TERM == "dumb" ]]; then
|
|
|
|
unsetopt zle
|
|
|
|
PS1='$ '
|
|
|
|
return
|
|
|
|
fi
|
2019-03-07 11:28:43 +01:00
|
|
|
|
2019-07-31 01:20:52 +02:00
|
|
|
plugins=(fzf fasd dotenv tmuxinator)
|
2019-07-30 23:54:50 +02:00
|
|
|
fpath=( ~/.kubectx/completion "${fpath[@]}" )
|
2018-04-12 09:44:52 +02:00
|
|
|
|
2019-07-30 23:54:50 +02:00
|
|
|
ZSH_CUSTOM="${HOME}/.zsh-custom"
|
2020-02-22 18:36:10 +01:00
|
|
|
{{- if eq .chezmoi.fullHostname "mcnaught.uberspace.de" }}
|
2020-02-22 18:33:59 +01:00
|
|
|
ZSH_THEME="jreese"
|
|
|
|
{{ else }}
|
2019-07-30 23:54:50 +02:00
|
|
|
ZSH_THEME="powerlevel10k/powerlevel10k"
|
2020-02-22 18:33:59 +01:00
|
|
|
{{- end }}
|
2019-07-30 23:54:50 +02:00
|
|
|
ZSH_DOTENV_FILE=".direnv"
|
2019-10-02 13:48:00 +02:00
|
|
|
FZF_MARKS_FILE="${HOME}/.config/fzf/${HOST}"
|
2017-12-05 22:12:38 +01:00
|
|
|
|
2019-07-30 23:54:50 +02:00
|
|
|
export ZSH=/home/bascht/.oh-my-zsh
|
2020-03-11 11:43:36 +01:00
|
|
|
export DISABLE_AUTO_UPDATE="true"
|
2018-04-23 08:27:53 +02:00
|
|
|
|
2019-07-30 23:54:50 +02:00
|
|
|
source $ZSH/oh-my-zsh.sh
|
|
|
|
source $ZSH_CUSTOM/plugins/fzf-marks/fzf-marks.plugin.zsh
|
2018-10-29 16:20:38 +01:00
|
|
|
|
2017-12-05 22:12:38 +01:00
|
|
|
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"
|
2019-02-07 10:51:30 +01:00
|
|
|
alias dcorrm="docker-compose run --rm"
|
2017-12-05 22:12:38 +01:00
|
|
|
alias emacseval="emacs -batch -l ~/.emacs.d/init.el -eval '(org-batch-agenda "a")'"
|
2019-10-15 22:13:35 +02:00
|
|
|
alias drri="docker run --rm -ti"
|
|
|
|
alias dry="drri -v /var/run/docker.sock:/var/run/docker.sock skanehira/docui"
|
2019-03-07 11:28:35 +01:00
|
|
|
alias k=kubectl
|
2020-05-27 12:24:55 +02:00
|
|
|
alias kgp="kubectl get pods"
|
|
|
|
alias krs="kubectl rollout status"
|
2019-07-31 02:02:41 +02:00
|
|
|
alias g=git
|
2020-05-27 12:24:55 +02:00
|
|
|
alias gpr="git pull -r"
|
2019-06-05 13:23:26 +02:00
|
|
|
alias git-cleanup-merged-branches="git fetch -va && git branch --merged | egrep -v '(^\*|master)' | xargs git branch -d"
|
2019-10-25 17:16:11 +02:00
|
|
|
alias wttr="curl 'wttr.in/Bogenhausen?1pQF&lang=de'"
|
|
|
|
alias termbin="nc termbin.com 9999"
|
2019-10-25 17:16:39 +02:00
|
|
|
alias ssh='TERM=xterm-256color ssh'
|
2020-01-20 12:20:03 +01:00
|
|
|
alias sudo='TERM=xterm-256color sudo'
|
|
|
|
alias gp="gopass"
|
|
|
|
alias hl="hledger"
|
2020-01-27 17:18:47 +01:00
|
|
|
alias cm="chezmoi"
|
|
|
|
alias cm-private="chezmoi -S ~/.local/share/chezmoi-private"
|
2020-05-27 12:24:55 +02:00
|
|
|
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) }
|
2020-01-20 12:20:03 +01:00
|
|
|
|
2018-11-12 10:13:57 +01:00
|
|
|
timestamp() { date +%Y-%m-%d-%H%M%S }
|
2020-06-18 17:20:44 +02:00
|
|
|
letterup() {
|
|
|
|
if [[ ! -a $1 ]]; then
|
|
|
|
take $1;
|
|
|
|
cp -a ~/Documents/Personal/Brief-Vorlage/2017-LaTeX/* .;
|
|
|
|
else
|
|
|
|
cd $1;
|
|
|
|
fi;
|
|
|
|
tmuxinator start letter;
|
|
|
|
}
|
2018-02-07 07:30:29 +01:00
|
|
|
|
2019-07-31 02:02:41 +02:00
|
|
|
# Pretty up FZF
|
|
|
|
export FZF_DEFAULT_OPTS='
|
2019-07-31 02:27:27 +02:00
|
|
|
--prompt=" "
|
2019-10-25 22:23:06 +02:00
|
|
|
--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
|
2019-07-31 02:02:41 +02:00
|
|
|
'
|
2019-07-16 14:10:01 +02:00
|
|
|
#source /usr/share/zsh/site-functions/tmuxinator.zsh
|
2019-06-05 13:22:52 +02:00
|
|
|
|
|
|
|
# Via @dohq
|
|
|
|
# https://gist.github.com/dohq/1dc702cc0b46eb62884515ea52330d60
|
|
|
|
function fzf-ssh () {
|
2019-07-30 23:54:50 +02:00
|
|
|
local selected_host=$(grep "Host " ~/.ssh/config | grep -v '*' | cut -b 6- | fzf --reverse --height=20 --query "$LBUFFER")
|
2019-06-05 13:22:52 +02:00
|
|
|
|
|
|
|
if [ -n "$selected_host" ]; then
|
|
|
|
BUFFER="ssh ${selected_host}"
|
|
|
|
zle accept-line
|
|
|
|
fi
|
|
|
|
zle reset-prompt
|
|
|
|
}
|
|
|
|
|
2019-10-15 20:28:49 +02:00
|
|
|
# Only load kubectl completion when needed. I's bog-slow
|
2019-10-18 16:42:58 +02:00
|
|
|
if [[ -f $KUBECONFIG ]]; then
|
2019-10-15 20:28:49 +02:00
|
|
|
source <(kubectl completion zsh);
|
|
|
|
fi;
|
|
|
|
|
2019-06-05 13:22:52 +02:00
|
|
|
zle -N fzf-ssh
|
|
|
|
bindkey '\es' fzf-ssh
|
|
|
|
|
2019-10-14 17:30:02 +02:00
|
|
|
function fzf-vm () {
|
2020-01-03 22:02:21 +01:00
|
|
|
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
|
2019-10-14 17:30:02 +02:00
|
|
|
}
|
2020-01-03 22:02:21 +01:00
|
|
|
zle -N fzf-vm
|
2019-10-14 17:30:02 +02:00
|
|
|
bindkey '\ev' fzf-vm
|
|
|
|
|
2020-01-17 17:12:45 +01:00
|
|
|
function ta () {
|
|
|
|
tmux attach $(tmux ls -F "#{session_name}" | fzf)
|
|
|
|
}
|
|
|
|
|
2019-07-30 23:54:50 +02:00
|
|
|
# Via @leahneukirchen
|
|
|
|
autoload -Uz copy-earlier-word
|
|
|
|
zle -N copy-earlier-word
|
|
|
|
bindkey "^[m" copy-earlier-word
|
|
|
|
|
2019-07-16 14:10:01 +02:00
|
|
|
if [ -f ~/Code/architecture/bin/ia ]; then
|
|
|
|
source <(~/Code/architecture/bin/ia completion)
|
|
|
|
fi;
|
2019-07-31 13:04:29 +02:00
|
|
|
|
2020-01-06 16:20:38 +01:00
|
|
|
if [ -f /home/bascht/Code/infrastructure-cli/Rakefile ]; then
|
|
|
|
alias chuck="rake -f /home/bascht/Code/infrastructure-cli/Rakefile"
|
|
|
|
fi;
|
|
|
|
|
2019-07-30 23:54:50 +02:00
|
|
|
source ~/.zsh-custom/plugins/
|
|
|
|
source ~/.p10k.zsh
|
2020-01-20 12:20:03 +01:00
|
|
|
autoload -U compinit && compinit
|