os/users/teutat3s/zshrc.nix
2022-01-19 01:13:15 +01:00

88 lines
2.5 KiB
Nix

{ config, pkgs, ... }:
''
bindkey "^[[1;3D" backward-word
bindkey "^[[1;3C" forward-word
bindkey "^[p" backward-word
bindkey "^[n" forward-word
# make cursor jump to slash, period, dash, underscore, dollar sign, equals sign
# by default: export WORDCHARS='*?_-.[]~=/&;!#$%^(){}<>'
export WORDCHARS='*?[]~&;!#$%^(){}'
# Alt+Backspace stops at /
bindkey "^[^?" backward-kill-word
backward-kill-dir () {
local WORDCHARS=''${WORDCHARS/\/}
zle backward-kill-word
}
zle -N backward-kill-dir
bindkey '^[^?' backward-kill-dir
# git aliases
alias ga="git add"
alias gau="git add --update"
alias gb="git branch"
alias gbd="git branch --delete"
alias gc="git commit"
alias gcm="git commit --message"
alias gco="git checkout"
alias gcob="git checkout -b"
alias gd="git diff"
alias gm="git merge"
alias gma="git merge --abort"
alias gmc="git merge --continue"
alias gp="git pull"
alias gs="git status"
# misc aliases
alias zshconfig="vim ~/.zshrc"
alias zshhistory="vim $XDG_DATA_HOME/zsh/zsh_history"
alias zshsource="source ~/.zshrc"
alias tp="triton profile set"
alias tt="triton"
alias ttco="triton-compose"
alias tf="terraform"
alias dstart="sudo systemctl start docker"
alias dstop="sudo systemctl stop docker"
alias lvstart="sudo systemctl start libvirtd"
alias lvstop="sudo systemctl stop libvirtd"
alias wg-up="sudo systemctl start wg-quick@wg0.service"
alias wg-down="sudo systemctl stop wg-quick@wg0.service"
# Helper function for docker on triton
ttdo () {
if [[ "$1" == "set" ]]; then
if [[ -n "$2" ]]; then
triton profile set "$2"
fi
source ~/CodeRoom/greenbaum.cloud/triton-docker.env.sh
elif [[ "$1" == "unset" ]]; then
eval "$(triton env --unset)" && unset TRITON_CNS_SEARCH_DOMAIN_PRIVATE TRITON_CNS_SEARCH_DOMAIN_PUBLIC
elif [[ "$1" == "env" ]]; then
env | grep "DOCKER\|TRITON\|SDC"
else
/usr/bin/docker $@
fi
}
# remove @machine from prompt
DEFAULT_USER=$(whoami)
# autocomplete cd ..
zstyle ':completion:*' special-dirs true
autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C ${pkgs.consul}/bin/consul consul
complete -o nospace -C ${pkgs.nomad}/bin/nomad nomad
complete -o nospace -C ${pkgs.vault}/bin/vault vault
complete -o nospace -C ${pkgs.terraform_0_15}/bin/terraform terraform
complete -o nospace -C ${pkgs.waypoint}/bin/waypoint waypoint
complete -C '${pkgs.awscli2}/bin/aws_completer' ${pkgs.awscli2}/bin/aws
source ${config.age.secrets.environment-secrets.path}
''