Skip to content

Instantly share code, notes, and snippets.

@tiagoamaro
Last active October 30, 2025 22:00
Show Gist options
  • Select an option

  • Save tiagoamaro/5330585 to your computer and use it in GitHub Desktop.

Select an option

Save tiagoamaro/5330585 to your computer and use it in GitHub Desktop.
ZSH=$HOME/.oh-my-zsh # Path to your oh-my-zsh configuration
ZSH_THEME="bira"
COMPLETION_WAITING_DOTS="true"
# Plugin repositories:
# => https://github.com/zsh-users/zsh-autosuggestions
# => https://github.com/zsh-users/zsh-syntax-highlighting
plugins=(zsh-autosuggestions zsh-syntax-highlighting)
# Fix zsh-syntax-highlight slow pasting
# Thanks to https://gist.github.com/magicdude4eva/2d4748f8ef3e6bf7b1591964c201c1ab
### Fix slowness of pastes with zsh-syntax-highlighting.zsh
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
}
pastefinish() {
zle -N self-insert $OLD_SELF_INSERT
}
zstyle :bracketed-paste-magic paste-init pasteinit
zstyle :bracketed-paste-magic paste-finish pastefinish
### Fix slowness of pastes
source $ZSH/oh-my-zsh.sh
alias docker-remove-stopped-containers='docker rm $(docker ps -aq --no-trunc -f status=exited)'
alias docker-remove-created-containers='docker rm $(docker ps -aq --no-trunc -f status=created)'
alias docker-remove-untagged-images='docker rmi $(docker images --quiet --filter "dangling=true")'
alias gall='gitk --all'
# alias git-delete-merged-on-master='git branch --merged | grep -v "^\s*\*\|\s*master$" | xargs git branch -d'
git-delete-merged-on-main() {
local branches=$(git branch --merged | grep -v "^\s*\*\|\s*main$\|\s*master$")
if [ -n "$branches" ]; then
echo "$branches" | xargs git branch -d
else
echo "No merged branches to delete"
fi
}
alias gitlog="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%aN>%Creset'"
alias h='heroku'
alias l='ls'
alias ll='ls -lash'
alias npm-cleanup='npm dedupe && npm prune && npm install'
alias open='xdg-open'
# alias shrug="echo \"\\\`¯\_(ツ)_/¯\\\`\" | pbcopy" # MacOS
alias shrug="echo \"\\\`¯\_(ツ)_/¯\\\`\" | xclip -sel clip" # Ubuntu
function festivalsay() { echo "$1" | festival --tts }
# alias say='spd-say'
alias say='festivalsay'
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# Rails
export EDITOR="code --wait" # satisfy $EDITOR for Rails credentials, git, etc.
# Gemfile.local
gemlocal(){
export BUNDLE_GEMFILE=Gemfile.local
echo "Gemfile.local loaded"
}
gemunlocal(){
unset BUNDLE_GEMFILE
echo "Gemfile.local is no longer used"
}
# WSL - Keep current path!
# https://learn.microsoft.com/en-us/windows/terminal/tutorials/new-tab-same-directory#zsh
#keep_current_path() {
# printf "\e]9;9;%s\e\\" "$(wslpath -w "$PWD")"
#}
#precmd_functions+=(keep_current_path)
# asdf v0.16+
PATH=/home/tiago/.asdf:$PATH
PATH=/home/tiago/.asdf/shims:$PATH
# Start Postgres whenever opening a new session
pg_ctl start > /dev/null 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment