Last active
February 15, 2026 12:12
-
-
Save rajhawaldar/d707d3542f4b5f090e6cf8aaaee01437 to your computer and use it in GitHub Desktop.
My personal ohmyzsh like setup
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
| # ~~~~~~~~~~~~~~~ Functions ~~~~~~~~~~~~~~~~~~~~~ | |
| # If asdf is setup uncomment below line | |
| # source /opt/homebrew/opt/asdf/libexec/asdf.sh | |
| # ~~~~~~~~~~~~~~~ History ~~~~~~~~~~~~~~~~~~~~~~~~ | |
| HISTFILE=~/.zsh_history | |
| HISTSIZE=100000 | |
| SAVEHIST=100000 | |
| setopt HIST_IGNORE_SPACE # Don't save when prefixed with space | |
| setopt HIST_IGNORE_DUPS # Don't save duplicate lines | |
| setopt SHARE_HISTORY # Share history between sessions | |
| # ~~~~~~~~~~~~~~~ list ~~~~~~~~~~~~~~~~~~~~~~~~ | |
| # alias la='exa -laghm@ --all --icons --git --color=always' | |
| export CLICOLOR=1 | |
| export LSCOLORS=GxFxCxDxBxegedabagaced | |
| alias ls="ls -G" | |
| alias ll="ls -lG" | |
| # ~~~~~~~~~~~~~~~ Completion ~~~~~~~~~~~~~~~~~~~~~~~~ | |
| autoload -Uz compinit | |
| compinit -u | |
| zstyle ':completion:*' menu select | |
| # source <(fzf --zsh) | |
| source <(mise completion zsh) | |
| source <(minikube completion zsh) | |
| eval "$(gh completion -s zsh)" | |
| # source <(terraform completion zsh) | |
| source <(docker completion zsh) | |
| # source <(kind completion zsh) | |
| [[ $commands[kubectl] ]] && source <(kubectl completion zsh) | |
| # ~~~~~~~~~~~~~~~ History Search ~~~~~~~~~~~~~~~~~~~~~~~~ | |
| autoload -U up-line-or-beginning-search | |
| autoload -U down-line-or-beginning-search | |
| zle -N up-line-or-beginning-search | |
| zle -N down-line-or-beginning-search | |
| bindkey "^[[A" up-line-or-beginning-search # Up | |
| bindkey "^[[B" down-line-or-beginning-search # Down | |
| unsetopt BEEP | |
| # ~~~~~~~~~~~~~~~ Prompt ~~~~~~~~~~~~~~~~~~~~~~~~ | |
| # ANSI color codes | |
| YELLOW='%F{yellow}' | |
| GREEN='%F{green}' | |
| RESET='%f' | |
| CYAN='%F{cyan}' | |
| RED='%F{red}' | |
| # Function to get Git branch name and detect changes | |
| git_branch_info() { | |
| if git rev-parse --is-inside-work-tree &>/dev/null; then | |
| # Get the branch name | |
| branch=$(git symbolic-ref --short HEAD 2>/dev/null || git describe --tags --exact-match 2>/dev/null) | |
| # Check for uncommitted changes | |
| if [[ -n $(git status --porcelain) ]]; then | |
| echo "${GREEN} ($branch*)${RESET}" | |
| else | |
| echo "${GREEN} ($branch)${RESET}" | |
| fi | |
| fi | |
| } | |
| function __build_prompt { | |
| local EXIT="$?" | |
| if [[ $EXIT -eq 0 ]]; then | |
| echo "${GREEN}✓${RESET} " | |
| else | |
| echo "${RED}✗${EXIT}${RESET} " | |
| fi | |
| } | |
| # Set prompt with cyan for directory and green for Git branch | |
| PROMPT='$(__build_prompt)${YELLOW}%1~${RESET}$(git_branch_info) ${CYAN}$ ${RESET}' | |
| # Enable color support for zsh | |
| autoload -U colors && colors | |
| setopt PROMPT_SUBST # Enable prompt substitution | |
| # ~~~~~~~~~~~~~~~ Aliases ~~~~~~~~~~~~~~~~~~~~~~~~ | |
| source ~/.aliases | |
| # direnv hook added (using for productivity metrics repository python code) | |
| # eval "$(direnv hook zsh)" | |
| # ~~~~~~~~~~~~~~~ Custom ~~~~~~~~~~~~~~~~~~~~~~~~ | |
| export PATH="$PATH:$HOME/Scripts" | |
| export PATH="/opt/homebrew/bin:$PATH" | |
| # ~~~~~~~~~~~~~~~ Path ~~~~~~~~~~~~~~~~~~~~~~~~ | |
| # Remove duplicate entries and non-existent directories | |
| # path=( ${(o)path} ) #sort paths (sorting path might be a bad idea of you want to follow some specific order) | |
| typeset -U path | |
| path=($^path(N-/)) | |
| export PATH | |
| export GPG_TTY=$(tty) | |
| eval "$(mise activate zsh)" | |
| [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment