Last active
February 16, 2023 10:15
-
-
Save nodegin/fdecfa1b5fa1e851e5aa5c9dd07c55ff to your computer and use it in GitHub Desktop.
2023 zshrc for work on mac
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
# brew install lolcat | |
# brew install thefuck | |
# brew install neofetch | |
# pnpm i -g git-cz | |
ZSH_THEME="lambda" | |
# install brew for both x64 and arm64: | |
# https://medium.com/mkdir-awesome/how-to-install-x86-64-homebrew-packages-on-apple-m1-macbook-54ba295230f | |
# setup alias to allow switch between envs | |
if (( $+commands[arch] )); then | |
alias a64="exec arch -arch arm64e '$SHELL'" | |
alias x64="exec arch -arch x86_64 '$SHELL'" | |
fi | |
function runs_on_ARM64() { [[ `uname -m` = "arm64" ]]; } | |
function runs_on_X86_64() { [[ `uname -m` = "x86_64" ]]; } | |
BREW_PATH_OPT="/opt/homebrew/bin" | |
BREW_PATH_LOCAL="/usr/local/bin" | |
function brew_exists_at_opt() { [[ -d ${BREW_PATH_OPT} ]]; } | |
function brew_exists_at_local() { [[ -d ${BREW_PATH_LOCAL} ]]; } | |
setopt no_global_rcs | |
typeset -U path PATH | |
path=($path /usr/sbin /sbin) | |
if runs_on_ARM64; then | |
path=($BREW_PATH_OPT(N-/) $BREW_PATH_LOCAL(N-/) $path) | |
export NVM_DIR="/opt/homebrew/opt/nvm" | |
else | |
path=($BREW_PATH_LOCAL(N-/) $path) | |
export NVM_DIR="/usr/local/opt/nvm" | |
fi | |
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm | |
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
## lolcat | |
lol() { | |
if [ -t 1 ]; then | |
"$@" |& lolcat | |
else | |
"$@" | |
fi | |
} | |
lol neofetch | |
## the fuck | |
eval $(thefuck --alias) | |
gacm() { | |
git add -A | |
echo "Enter the scope for the commit: " | |
read scope | |
if [ -z "$@" ]; then | |
git-cz --disable-emoji --scope="$scope" | |
else | |
git-cz --disable-emoji --scope="$scope" --subject="$@" --body="$@" | |
fi | |
} | |
unalias gp | |
gp() { | |
local OPTIND cmd="git push" | |
while getopts ":f" option; do | |
case $option in | |
f) cmd="git push --force-with-lease --force-if-includes" ;; | |
?) ;; | |
esac | |
done | |
eval $cmd | |
if [ $? -ne 0 ]; then | |
eval "$(thefuck $cmd)" | |
fi | |
} | |
alias f='lol fuck' | |
alias cat='lol cat' | |
alias ll='lol ls -lah' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment