Skip to content

Instantly share code, notes, and snippets.

@helmerdavila
Last active September 16, 2021 15:20
Show Gist options
  • Save helmerdavila/83b3fabdc6e206925bdf5c7636a60da4 to your computer and use it in GitHub Desktop.
Save helmerdavila/83b3fabdc6e206925bdf5c7636a60da4 to your computer and use it in GitHub Desktop.
πŸ€‘ ZSH CONFIG HELMER πŸ€‘
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Langs (required for Python)
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Path
export PATH=$HOME/bin:$HOME/.composer/vendor/bin:/usr/local/bin:$PATH
export PATH=$HOME/.jetbrains:$PATH
# export BAT_THEME="OneHalfLight"
export BAT_THEME="OneHalfDark"
# OpenSSL
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"
# Android Studio
export ANDROID_HOME=$HOME/Library/Android/sdk
# Check always your /Library/Java/JavaVirtualMachines/ to check what jdk version you have installed
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home"
export PATH=$PATH:$ANDROID_HOME/emulator:$PATH
export PATH=$PATH:$ANDROID_HOME/tools:$PATH
export PATH=$PATH:$ANDROID_HOME/tools/bin:$PATH
export PATH=$PATH:$ANDROID_HOME/platform-tools:$PATH
# Flutter
export PATH=$PATH:$HOME/flutter/bin
# MySQL
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
# Exporting PostgresSQL variables
export PATH="/usr/local/opt/postgresql@10/bin:$PATH"
export PKG_CONFIG_PATH="/usr/local/opt/postgresql@10/lib/pkgconfig"
export LDFLAGS="-L/usr/local/opt/postgresql@10/lib"
export CPPFLAGS="-I/usr/local/opt/postgresql@10/include"
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
# Yarn
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
export PATH="/usr/local/sbin:$PATH"
# NVM
export NVM_DIR="$HOME/.nvm"
[ -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
# Used by tmux
export TERM="xterm-256color"
# Composer unlimited memory
export COMPOSER_MEMORY_LIMIT=-1
export UPDATE_ZSH_DAYS=1
plugins=(git docker docker-compose pyenv ruby rbenv)
source $ZSH/oh-my-zsh.sh
# Scripts that use Node or Yarn but prevents Mac indexing
function npm_yarn_install {
if [ -f yarn.lock ]; then
yarn install $@
else
npm install $@
fi
touch ./node_modules/.metadata_never_index
}
alias hinstall=npm_yarn_install
function npm_yarn_remove {
if [ -f yarn.lock ]; then
yarn remove $@
else
npm uninstall $@
fi
touch ./node_modules/.metadata_never_index
}
alias hremove=npm_yarn_remove
function npm_yarn_add {
if [ -f yarn.lock ]; then
yarn add $@
else
npm install $@ --save
fi
touch ./node_modules/.metadata_never_index
}
alias hadd=npm_yarn_add
function rename_files {
for f in *.js; do mv -- "$f" "${f%.js}.ts"; done
}
alias hrename=rename_files
# Nvm .nvmrc auto usage
autoload -U add-zsh-hook
# ColorLS: requires gem install colorls
source $(dirname $(gem which colorls))/tab_complete.sh
alias lc="colorls -lA --sd"
# Aliases
alias zshconfig="vim ~/.zshrc"
alias art="php artisan"
alias t="vendor/bin/phpunit"
alias gs="git status"
alias gaa="git add -A"
alias gcmsg="git commit -m"
alias cup="composer outdated --outdated --direct"
alias yup="yarn upgrade-interactive --latest"
alias tinker="php artisan tinker"
alias brew-all="brew services list"
alias brew-start="brew services start"
alias brew-stop="brew services stop"
alias logit="git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --branches"
alias zshfresh="source ~/.zshrc"
# Bat aliases for different theme
alias batl="bat --theme=OneHalfLight"
alias batd="bat --theme=OneHalfDark"
# Powerlevel9k Font, you should use NerdFonts and this setting must be before the theme is declared
POWERLEVEL9K_MODE='nerdfont-complete'
# Zplug section
export ZPLUG_HOME=/usr/local/opt/zplug
source $ZPLUG_HOME/init.zsh
zplug "zsh-users/zsh-syntax-highlighting", defer:2
zplug "romkatv/powerlevel10k", as:theme, depth:1
zplug "zsh-users/zsh-autosuggestions"
zplug "mattberther/zsh-pyenv"
zplug load
# Powerlevel9K config
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon docker_machine dir direnv vcs pyenv nvm aws rbenv)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time public_ip vpn_ip)
# tabtab source for packages
# uninstall by removing these lines
[[ -f ~/.config/tabtab/__tabtab.zsh ]] && . ~/.config/tabtab/__tabtab.zsh || true
eval "$(direnv hook zsh)"
eval "$(rbenv init -)"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment