Skip to content

Instantly share code, notes, and snippets.

@avatar-lavventura
Created March 26, 2026 10:22
Show Gist options
  • Select an option

  • Save avatar-lavventura/9f6123c70edeb63c17ad4c32394b3a7f to your computer and use it in GitHub Desktop.

Select an option

Save avatar-lavventura/9f6123c70edeb63c17ad4c32394b3a7f to your computer and use it in GitHub Desktop.
#
uname_out="$(uname -s)"
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# export ZSH_HIGHLIGHT_HIGHLIGHTERS=(cursor)
# 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
# If you come from bash you might have to change your $PATH.
export COLORTERM=truecolor
export DEFAULT_USER="$(whoami)"
export ZSH=$HOME"/.oh-my-zsh"
CASE_SENSITIVE="true" # Uncomment the following line to use case-sensitive completion.
# Path to your oh-my-zsh installation.
#POWERLINE_HIDE_USER_NAME="false"
#POWERLINE_HIDE_HOST_NAME="false"
# export ZPLUG_HOME=~/.zplug
# source ~/.zplug/init.zsh
# Uncomment the following line to disable bi-weekly auto-update checks.
DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to disable auto-setting terminal title.
DISABLE_AUTO_TITLE="true"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
# ZSH_THEME="dracula"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=10
ZSH_CUSTOM_AUTOUPDATE_QUIET=true
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS=true
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
FILTER_BRANCH_SQUELCH_WARNING=1
# GITSTATUS_LOG_LEVEL=DEBUG
export LSCOLORS=ExGxBxDxCxEgEdxbxgxcxd
export LS_COLORS="$LS_COLORS:ow=1;34:tw=1;34:*.tar=1;31:*.tgz=1;31:*.arj=1;31:*.taz=1;31:*.lzh=1;31:*.lzma=1;31:*.tlz=1;31:*.txz=1;31:*.zip=1;31:*.z=1;31:*.Z=1;31:*.dz=1;31:*.gz=1;31:*.lz=1;31:*.xz=1;31:*.bz2=1;31:*.bz=1;31:*.tbz=1;31:*.tbz2=1;31:*.tz=1;31:*.deb=1;31:*.rpm=1;31:*.jar=1;31:*.war=1;31:*.ear=1;31:*.sar=1;31:*.rar=1;31:*.ace=1;31:*.zoo=1;31:*.cpio=1;31:*.7z=1;31:*.rz=1;31:*.json=00;35"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
#
# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
# https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git-flow
plugins=( # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins
aliases
branch
brew
colored-man-pages
cp
debian
dirhistory
docker
docker-compose
fzf
gcloud
gh
gitfast
git-auto-fetch
git-extras
git-flow
gitignore
git-prompt
git-prompt
gnu-utils
gpg-agent
history
ipfs
ipfs
iterm2
macos
man
mongocli
pip
rsync
ruby
sudo
z
zsh-safe-rm
zsh-syntax-highlighting
# git-flow-completion
# you-should-use
# dotenv
# history-substring-search
)
source ~/personalize/git-flow-completion.zsh
GIT_AUTO_FETCH_INTERVAL=30 # in seconds 1200 default
if [ -z "$_zsh_custom_scripts_loaded" ]; then
_zsh_custom_scripts_loaded=1
fi
# https://gist.github.com/msabramo/2355834#gistcomment-3533514
function git_prompt_info() {
local ref
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then
ref=$(__git_prompt_git symbolic-ref HEAD 2> /dev/null) || \
ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) || return 0
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
fi
fi
}
function ls {
output=$(command ls -h --color=always -v --author --time-style=long-iso -C | wc -l)
if [ $output -gt 20 ]; then
command ls -h --color=always -v --author --time-style=long-iso -C "$@" | less -R
else
command ls -h --color=always -v --author --time-style=long-iso -C "$@" | less -R -F -X
fi
}
function precmd() {
printf "\033];$(whoami)@$(hostname):${PWD/#$HOME/~}\007";
# sets the tab title to current dir
echo -ne "\e]1;${PWD##*/}\a"
}
export COLUMNS # Remember columns for subprocesses
source $HOME/.oh-my-zsh/oh-my-zsh.sh
source ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/z/z.sh
## History command configuration
setopt inc_append_history # append into history file
setopt extended_history # record timestamp of command in HISTFILE
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_SAVE_NO_DUPS # do not save duplicated command
setopt HIST_REDUCE_BLANKS # delete empty lines from history file
setopt HIST_NO_STORE # do not add history and fc commands to the history
setopt INC_APPEND_HISTORY_TIME # append command to history file immediately after execution
setopt +o nomatch
# Disable the default prompt that says
# 'zsh: sure you want to delete all 4 files in /home/user [yn]?'
setopt rmstarsilent
FILE=~/.p10k.zsh # to customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[ -f $FILE ] && source $FILE
FILE=~/.ssh_addresses
[ -f $FILE ] && source $FILE
FILE=~/.aliases
[ -f $FILE ] && source $FILE
FILE=~/.zpath
[ -f $FILE ] && source $FILE
FILE=~/venv/bin/activate
[ -f $FILE ] && source $FILE
# user configuration
source ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k/powerlevel10k.zsh-theme
fignore=(\~)
case "${uname_out}" in
Darwin*) # UNIX
export PATH=/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:$PATH
export PATH=/usr/local/opt/coreutils/libexec/gnubin:$PATH
export PATH=~/.npm-packages/bin:$PATH
export PATH=/usr/local/opt/curl/bin:$PATH
export PATH=/usr/local/opt/imagemagick@6/bin:$PATH
export PATH=/usr/local/opt/make/libexec/gnubin:$PATH
# export PATH=$(brew --prefix)/opt/findutils/libexec/gnubin:$PATH #: brew install findutils
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
;;
*)
esac
if [[ $TERM = dumb ]]; then
unset zle_bracketed_paste
fi
# fix slowness of pastes with zsh-syntax-highlighting.zsh
# https://github.com/zsh-users/zsh-autosuggestions/issues/276
# https://gist.github.com/magicdude4eva/2d4748f8ef3e6bf7b1591964c201c1ab
# https://github.com/zsh-users/zsh-autosuggestions/issues/238#issuecomment-389324292
# This speeds up pasting w/ autosuggest
# https://github.com/zsh-users/zsh-autosuggestions/issues/238
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 ':autocomplete:*' default-context history-incremental-search-backward
zstyle :bracketed-paste-magic paste-init pasteinit
zstyle :bracketed-paste-magic paste-finish pastefinish
source $ZSH/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh # fix slowness of pastes
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
case "${uname_out}" in
Darwin*) # UNIX
DIR=$HOME/venv
[ ! -d $DIR ] && python3.8 -m venv $DIR
export LDFLAGS="-L/usr/local/opt/binutils/lib"
export CPPFLAGS="-I/usr/local/opt/binutils/include"
#
emacs_pn="macs --bg-daemon"
num=$(ps aux | grep -E $emacs_pn | grep -E " SNsl | SNs | Ss | S" | wc -l)
if [ $num -eq 0 ]; then
(&>/dev/null emacsclient -cqut ~/todo/todo/.todo-list.org &)
fi
;;
*) # LINUX
DIR=$HOME/venv
[ ! -d $DIR ] && python3 -m venv $DIR
FILE=~/venv/bin/eblocbroker
[ -f $FILE ] && eval "$(register-python-argcomplete $FILE)"
#
emacs_pn="[e]macs --daemon"
num=$(ps aux | grep -E $emacs_pn | grep -E " SNsl | SNs | Ss | S" | wc -l)
if [ $num -eq 0 ]; then
(&>/dev/null emacsclient -cqut &)
fi
;;
esac
if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi
# source ~/.bash_completion.d/python-argcomplete
# [[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && source ~/.autojump/etc/profile.d/autojump.sh
# if [ $(hostname) == "ocean" ]; then
# if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then
# export GPG_TTY=$(tty)
# tmux -CC new -A -s main
# # tmux attach-session -t ssh_tmux || tmux new-session -s ssh_tmux
# fi
# fi
# source $ZSH_CUSTOM/plugins/zsh-autocomplete/zsh-autocomplete.plugin.zsh
# zstyle ':autocomplete:tab:*' widget-style menu-select
# zstyle ':autocomplete:*' config off
zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
# Disable hostname completion
zstyle ':completion:*' hosts off
# https://stackoverflow.com/a/44237513/2402577
# source ~/personalize/bin/git-prompt.sh
# export GIT_PS1_SHOWDIRTYSTATE=1
# export PS1='\w$(__git_ps1 " (%s)")\$ '
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
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
__git_files () {
_wanted files expl 'local files' _files
}
command rm -f ~/.zcompdump >/dev/null 2>&1
# configure node version manager
export NVM_DIR=~/.nvm
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" --no-use # This loads nvm
alias node='unalias node ; unalias npm ; nvm use default ; node $@'
alias npm='unalias node ; unalias npm ; nvm use default ; npm $@'
export NODE_OPTIONS=--openssl-legacy-provider
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
DISABLE_UNTRACKED_FILES_DIRTY="true" # https://superuser.com/a/1135242/723632
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment