2022-03-04 14:11:19 +00:00
|
|
|
{ config, pkgs, tritonshell, ... }:
|
2021-06-06 13:22:44 +00:00
|
|
|
''
|
|
|
|
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
|
2022-02-02 02:07:28 +00:00
|
|
|
ttp() {
|
2021-06-06 13:22:44 +00:00
|
|
|
if [[ "$1" == "set" ]]; then
|
|
|
|
if [[ -n "$2" ]]; then
|
2022-04-26 09:20:22 +00:00
|
|
|
source ${tritonshell.packages.${pkgs.system}.triton-utils}/bin/unset-env.sh
|
2021-06-06 13:22:44 +00:00
|
|
|
triton profile set "$2"
|
|
|
|
fi
|
2022-03-04 14:11:19 +00:00
|
|
|
source ${tritonshell.packages.${pkgs.system}.triton-docker-env}/bin/triton-docker-env.sh
|
2021-06-06 13:22:44 +00:00
|
|
|
elif [[ "$1" == "unset" ]]; then
|
2022-03-04 14:11:19 +00:00
|
|
|
source ${tritonshell.packages.${pkgs.system}.triton-utils}/bin/unset-env.sh
|
2021-06-06 13:22:44 +00:00
|
|
|
elif [[ "$1" == "env" ]]; then
|
2022-02-02 02:07:28 +00:00
|
|
|
env | grep "DOCKER\|MANTA\|SDC\|TRITON" | sort
|
2021-06-06 13:22:44 +00:00
|
|
|
else
|
2022-02-02 02:07:28 +00:00
|
|
|
echo "this is a helper function to quickly switch triton profiles"
|
|
|
|
echo "and setup the required environment variables"
|
|
|
|
echo "for triton, manta and the remote docker host (API)"
|
|
|
|
echo
|
|
|
|
echo 'use "ttp set your-profile" to switch to a profile'
|
|
|
|
echo
|
|
|
|
echo 'use "ttp unset" to clear all environment variables used by these CLIs'
|
|
|
|
echo "useful if you'd like to run a docker command against the"
|
|
|
|
echo "local docker host"
|
|
|
|
echo
|
|
|
|
echo 'use "ttp env" to view the currently set environment variables'
|
|
|
|
echo "used by the triton & manta CLIs"
|
|
|
|
echo
|
|
|
|
echo 'use "ttp help" to view this help'
|
2021-06-06 13:22:44 +00:00
|
|
|
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
|
2022-07-07 20:23:27 +00:00
|
|
|
complete -o nospace -C ${pkgs.nomad_1_3}/bin/nomad nomad
|
2021-06-06 13:22:44 +00:00
|
|
|
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
|
|
|
|
|
2022-01-19 00:13:15 +00:00
|
|
|
source ${config.age.secrets.environment-secrets.path}
|
2021-06-06 13:22:44 +00:00
|
|
|
''
|