Refactor to support multiple OS's
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
62
home/.dotfiles/1-zsh
Normal file
62
home/.dotfiles/1-zsh
Normal file
@@ -0,0 +1,62 @@
|
||||
export ZSH="$HOME/.oh-my-zsh"
|
||||
|
||||
plugins=(
|
||||
zsh-syntax-highlighting
|
||||
)
|
||||
autoload -U compinit
|
||||
|
||||
# Use this setting if you want to disable marking untracked files under VCS as dirty.
|
||||
# This makes repository status checks for large repositories much, much faster.
|
||||
DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||
SHOW_AWS_PROMPT=false
|
||||
COMPLETION_WAITING_DOTS=true
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
zstyle ':omz:update' mode reminder
|
||||
|
||||
source `brew --prefix switch`/switch.sh
|
||||
|
||||
|
||||
# History
|
||||
HISTFILE="$HOME/.zsh_history"
|
||||
HISTIGNORE="&:exit:reset:clear:zh"
|
||||
setopt append_history
|
||||
setopt hist_ignore_space
|
||||
setopt HIST_IGNORE_DUPS
|
||||
setopt sharehistory
|
||||
setopt INC_APPEND_HISTORY
|
||||
setopt HIST_REDUCE_BLANKS
|
||||
|
||||
# Options
|
||||
setopt autocd
|
||||
autoload -U add-zsh-hook
|
||||
|
||||
|
||||
DISABLE_AUTO_TITLE="true"
|
||||
|
||||
# Override auto-title when static titles are desired ($ title My new title)
|
||||
title() { export TITLE_OVERRIDDEN=1; echo -en "\e]0;$*\a"}
|
||||
# Turn off static titles ($ autotitle)
|
||||
autotitle() { export TITLE_OVERRIDDEN=0 }; autotitle
|
||||
# Condition checking if title is overridden
|
||||
overridden() { [[ $TITLE_OVERRIDDEN == 1 ]]; }
|
||||
|
||||
# Show cwd when shell prompts for input.
|
||||
precmd() {
|
||||
if overridden; then return; fi
|
||||
pwd=$(pwd) # Store full path as variable
|
||||
cwd=${pwd##*/} # Extract current working dir only
|
||||
print -Pn "\e]0;$cwd\a" # Replace with $pwd to show full path
|
||||
}
|
||||
|
||||
# Prepend command (w/o arguments) to cwd while waiting for command to complete.
|
||||
preexec() {
|
||||
if overridden; then return; fi
|
||||
printf "\033]0;%s\a" "${1%% *} | $cwd" # Omit construct from $1 to show args
|
||||
}
|
||||
|
||||
|
||||
# Giant Swarm specific
|
||||
which opsctl &>/dev/null && opsctl completion zsh > /usr/local/share/zsh/site-functions/_opsctl
|
||||
which gsctl &>/dev/null && gsctl completion zsh --stdout > /usr/local/share/zsh/site-functions/_gsctl
|
||||
which devctl &>/dev/null && devctl completion zsh > /usr/local/share/zsh/site-functions/_devctl
|
63
home/.dotfiles/aliases
Normal file
63
home/.dotfiles/aliases
Normal file
@@ -0,0 +1,63 @@
|
||||
# Rename existing tools
|
||||
alias _cat=`which cat`
|
||||
alias _curl=`which curl`
|
||||
alias _ls="/bin/ls"
|
||||
alias _grep="/bin/grep"
|
||||
alias _diff="/usr/bin/diff"
|
||||
alias _du=`which du`
|
||||
alias _df=`which df`
|
||||
alias _find=`which find`
|
||||
alias _top=`which top`
|
||||
alias _ps="/bin/ps"
|
||||
alias _dig=`which dig`
|
||||
alias _git=`which git`
|
||||
|
||||
# Aliases
|
||||
alias cat='bat '
|
||||
alias curl='curlie'
|
||||
alias ls='exa --group-directories-first --icons --header --git --ignore-glob=.git'
|
||||
alias grep='rg'
|
||||
alias diff='delta'
|
||||
alias du='dust'
|
||||
alias df='duf -hide special'
|
||||
alias find='fd'
|
||||
alias bandwhich='sudo bandwhich'
|
||||
alias top='btm'
|
||||
alias ps='procs'
|
||||
alias dig='dog'
|
||||
alias kubectx='switch'
|
||||
alias kctx='switch'
|
||||
alias machine-info='macchina -t Boron --bar'
|
||||
alias watch='watch '
|
||||
alias tmp='cd $(mktemp -d)'
|
||||
|
||||
lt() {
|
||||
DEPTH=$(echo $1 | grep "^[0-9]*$")
|
||||
if [ "$DEPTH" = "" ]; then
|
||||
DEPTH=2
|
||||
else
|
||||
shift
|
||||
fi
|
||||
ls -l --tree -L $DEPTH -I ".git|cache|log|logs|node_modules|vendor" $@
|
||||
}
|
||||
|
||||
git() {
|
||||
if [ "$1" = "take" ]; then # Git clone then cd into new directory
|
||||
_git clone $2
|
||||
cd $(basename $2 | sed 's/\.git$//')
|
||||
elif [ "$1" = "commit" ]; then # Sign all commits
|
||||
shift
|
||||
_git commit -s $@
|
||||
else
|
||||
_git $@
|
||||
fi
|
||||
}
|
||||
|
||||
# Giant Swarm specific
|
||||
alias prom='opsctl open -a prometheus --sso -i'
|
||||
alias happa='opsctl open -a happa --sso -i'
|
||||
alias grafana='opsctl open -a grafana --sso -i'
|
||||
alias argo='opsctl open -a argocd --sso -i'
|
||||
alias cloud-provider='opsctl open -a cloudprovider -i'
|
||||
alias get-cluster='gs-get-cluster'
|
||||
alias create-cluster='gs-create-cluster'
|
26
home/.dotfiles/environment
Normal file
26
home/.dotfiles/environment
Normal file
@@ -0,0 +1,26 @@
|
||||
export EDITOR='vim'
|
||||
export VISUAL='code'
|
||||
export GPG_TTY=$(tty)
|
||||
|
||||
# AWS
|
||||
if [ -f ~/.aws/profile ]; then
|
||||
export AWS_PROFILE=$(cat ~/.aws/profile)
|
||||
export AWS_DEFAULT_REGION=eu-west-1
|
||||
export AWS_REGION=eu-west-1
|
||||
fi
|
||||
|
||||
# Node
|
||||
export NODE_ENV=localhost
|
||||
[ -f ~/.npmrc ] && export NPM_TOKEN=`head -n 1 ~/.npmrc | sed 's~//registry.npmjs.org/:_authToken=\(.*\)~\1~'`
|
||||
|
||||
# Go
|
||||
export GOPATH=$HOME/goworkspace
|
||||
export GO111MODULE=on
|
||||
|
||||
# Starship
|
||||
export STARSHIP_CONFIG=~/.starship/config.toml
|
||||
export STARSHIP_LOG=error
|
||||
|
||||
# Bat
|
||||
export BAT_THEME="Monokai Extended Light"
|
||||
export BAT_STYLE="grid,header"
|
10
home/.dotfiles/kubernetes
Normal file
10
home/.dotfiles/kubernetes
Normal file
@@ -0,0 +1,10 @@
|
||||
alias k='kubectl '
|
||||
alias kx='kube-exec '
|
||||
alias kl='kube-logs '
|
||||
alias kshell='kube-shell '
|
||||
alias kall='kube-all '
|
||||
alias fix-broken-replicasets='kube-clean-replicasets '
|
||||
alias kube-forward='kube-forward-all '
|
||||
|
||||
source <(kubectl completion zsh)
|
||||
source <(tkn completion zsh)
|
Reference in New Issue
Block a user