Last active
January 12, 2023 05:12
-
-
Save dre1080/ed7e0e3a689799f9226a23a5dfa528de to your computer and use it in GitHub Desktop.
my dotfiles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my dotfiles |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# reset when .zshrc changes | |
ZGEN_RESET_ON_CHANGE=(${HOME}/.zshrc) | |
# disable auto update for ohmyzsh | |
DISABLE_AUTO_UPDATE="true" | |
# skip the verification of insecure directories | |
ZSH_DISABLE_COMPFIX="true" | |
# load zgenom | |
source "${HOME}/.zgenom/zgenom.zsh" | |
# Check for plugin and zgenom updates every 7 days | |
# This does not increase the startup time. | |
zgenom autoupdate | |
# if the init script doesn't exist | |
if ! zgenom saved; then | |
# plugins | |
zgenom ohmyzsh | |
zgenom ohmyzsh plugins/asdf | |
zgenom ohmyzsh plugins/command-not-found | |
zgenom ohmyzsh plugins/composer | |
zgenom ohmyzsh plugins/docker-compose | |
zgenom ohmyzsh plugins/docker | |
zgenom ohmyzsh plugins/git | |
zgenom ohmyzsh plugins/history-substring-search | |
zgenom ohmyzsh plugins/mix | |
zgenom ohmyzsh plugins/npm | |
zgenom ohmyzsh plugins/systemd | |
zgenom ohmyzsh plugins/ubuntu | |
zgenom load gusaiani/elixir-oh-my-zsh | |
zgenom load agkozak/zsh-z | |
zgenom load unixorn/autoupdate-zgenom | |
zgenom load zsh-users/zsh-syntax-highlighting | |
zgenom load zsh-users/zsh-history-substring-search | |
zgenom load spaceship-prompt/spaceship-prompt spaceship | |
# generate the init script from plugins above | |
zgenom save | |
# Compile your zsh files | |
zgenom compile "$HOME/.zshrc" | |
fi | |
# preferred editor for local and remote sessions | |
if [[ -n $SSH_CONNECTION ]]; then | |
# SSH mode | |
export EDITOR="nano" | |
else | |
# local terminal mode | |
export EDITOR="code -w" | |
fi | |
# enable IEx history | |
# see: https://hexdocs.pm/iex/IEx.html#module-shell-history | |
(( $+commands[iex] )) && export ERL_AFLAGS="-kernel shell_history enabled" | |
# setup golang | |
if (( $+commands[go] )); then | |
export GO111MODULE=on | |
export GOPROXY="https://proxy.golang.org" | |
export GOPATH=$HOME/go | |
PATH="$GOPATH/bin:$PATH" | |
fi | |
# setup rubygems | |
(( $+commands[gem] )) && PATH="$(gem environment gemdir)/bin:$PATH" | |
# add python/pip location | |
PATH="$PATH:/home/ando/.local/bin" | |
# add custom aliases | |
alias cout="composer outdated" | |
alias tarf="find . -maxdepth 1 -mindepth 1 -type d -exec tar -zcvf {}.tar.gz {} \;" | |
alias erlv="erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), \"releases\", erlang:system_info(otp_release), \"OTP_VERSION\"])), io:fwrite(Version), halt().' -noshell" | |
alias ..="cd .." | |
alias apt="apt-fast" | |
alias apt-get="apt-fast" | |
alias fp-clean="flatpak repair && sudo rm -rfv /var/tmp/flatpak-cache-*" | |
# start detached background process | |
start-proc() { | |
echo "Starting detached process '${1}'..." | |
exec $@ </dev/null &>/dev/null & | |
} | |
# update all asdf plugins to their latest versions | |
asdf-update-all() { | |
log() { | |
echo | |
printf "%s %s\n" "->" "$1" | |
} | |
log "Updating all asdf-plugin remotes..." | |
asdf plugin update --all | |
log "Updating each plugin reference to the latest revision..." | |
cat ~/.tool-versions \ | |
| awk '{print $1}' \ | |
| xargs -I {} bash -c 'echo {} $(asdf latest {})' > ~/.tool-versions.new; \ | |
cp ~/.tool-versions ~/.tool-versions.bk; \ | |
mv ~/.tool-versions.new ~/.tool-versions | |
log "Old revision versions:" | |
cat ~/.tool-versions.bk | |
log "New revision versions:" | |
cat ~/.tool-versions | |
while true; do | |
echo | |
read "yn?Do you wish to install all new revisions? " | |
case $yn in | |
[Yy]) asdf install; break;; | |
[Nn]) break;; | |
*) echo "Please answer Yes or No.";; | |
esac | |
done | |
echo | |
log "Done, bye! 👋" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment