forked from pub-solar/os
102 lines
3.3 KiB
Nix
102 lines
3.3 KiB
Nix
{ config, pkgs, tritonshell, ... }:
|
|
''
|
|
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
|
|
ttp() {
|
|
if [[ "$1" == "set" ]]; then
|
|
if [[ -n "$2" ]]; then
|
|
source ${tritonshell.packages.${pkgs.system}.triton-utils}/bin/unset-env.sh
|
|
triton profile set "$2"
|
|
fi
|
|
source ${tritonshell.packages.${pkgs.system}.triton-docker-env}/bin/triton-docker-env.sh
|
|
elif [[ "$1" == "unset" ]]; then
|
|
source ${tritonshell.packages.${pkgs.system}.triton-utils}/bin/unset-env.sh
|
|
elif [[ "$1" == "env" ]]; then
|
|
env | grep "DOCKER\|MANTA\|SDC\|TRITON" | sort
|
|
else
|
|
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'
|
|
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}
|
|
''
|