Created
November 19, 2025 19:59
-
-
Save JohnTortugo/622771366b9f71b77d6b3bb529c61e72 to your computer and use it in GitHub Desktop.
ZSH Basic Config
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
| ## # OSX useful installs | |
| ## | |
| ## brew install fzf | |
| ## $(brew --prefix)/opt/fzf/install | |
| ## brew install fd | |
| ## brew install ripgrep | |
| ## | |
| ## ---------------------------- | |
| ## # Amazon Linux installs | |
| ## | |
| ## sudo yum install -y curl tar | |
| ## curl -LO https://github.com/BurntSushi/ripgrep/releases/latest/download/ripgrep-*-x86_64-unknown-linux-musl.tar.gz | |
| ## tar xf ripgrep-*-x86_64-unknown-linux-musl.tar.gz | |
| ## sudo mv ripgrep-*/rg /usr/local/bin/ | |
| ## | |
| ## curl -LO https://github.com/sharkdp/fd/releases/latest/download/fd-*-x86_64-unknown-linux-musl.tar.gz | |
| ## tar xf fd-*-x86_64-unknown-linux-musl.tar.gz | |
| ## sudo mv fd-*/fd /usr/local/bin/ | |
| ## | |
| ## sudo yum install -y git | |
| ## git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf | |
| ## ~/.fzf/install | |
| ##### --------------------------------------------------------- | |
| ##### Core Options & Shell Behavior | |
| ##### --------------------------------------------------------- | |
| # Use modern completion system | |
| autoload -Uz compinit | |
| compinit | |
| # Speed up completion by caching | |
| zstyle ':completion:*' use-cache on | |
| zstyle ':completion:*' cache-path ~/.zsh/cache | |
| # Enable colors in ls, grep, etc. | |
| autoload -U colors && colors | |
| setopt AUTO_CD # 'cd somedir' → type 'somedir' | |
| setopt AUTO_PUSHD # pushd on cd | |
| setopt PUSHD_IGNORE_DUPS | |
| setopt PUSHD_SILENT | |
| setopt EXTENDED_GLOB # powerful zsh globbing | |
| setopt HIST_IGNORE_ALL_DUPS | |
| setopt HIST_IGNORE_SPACE | |
| setopt SHARE_HISTORY # share history across sessions | |
| setopt INC_APPEND_HISTORY | |
| setopt CORRECT # autocorrect commands | |
| setopt NO_BEEP | |
| setopt PROMPT_SUBST | |
| # History | |
| HISTFILE=~/.zsh_history | |
| HISTSIZE=50000 | |
| SAVEHIST=50000 | |
| ##### --------------------------------------------------------- | |
| ##### Path / Environment | |
| ##### --------------------------------------------------------- | |
| export EDITOR=vim | |
| export VISUAL=vim | |
| export LANG="en_US.UTF-8" | |
| export LC_ALL="en_US.UTF-8" | |
| # Custom bin | |
| export PATH="$HOME/bin:$HOME/.local/bin:$PATH" | |
| export BRAZIL_WORKSPACE_DEFAULT_LAYOUT=short | |
| export AUTO_TITLE_SCREENS="NO" | |
| # if you wish to use IMDS set AWS_EC2_METADATA_DISABLED=false | |
| export AWS_EC2_METADATA_DISABLED=true | |
| # use GCC10 instead of the old GCC available on AMZ Cloud Desktops | |
| export CROSS_COMPILE=gcc10- | |
| export CC=gcc10-gcc | |
| export CXX=gcc10-g++ | |
| export HOSTCC=gcc10-gcc | |
| export HOSTCXX=gcc10-g++ | |
| export LD=gcc10-ld.bfd | |
| export GDB=gcc10-ld.bfd | |
| ##### --------------------------------------------------------- | |
| ##### Aliases | |
| ##### --------------------------------------------------------- | |
| alias ll='ls -lh' | |
| alias la='ls -lah' | |
| alias l='ls -1' | |
| alias grep='grep --color=auto' | |
| alias df='df -h' | |
| alias du='du -h' | |
| alias g='git' | |
| alias gst='git status' | |
| alias gc='git commit' | |
| alias gl='git log --oneline --graph --decorate' | |
| alias bb=brazil-build | |
| alias bba='brazil-build apollo-pkg' | |
| alias bre='brazil-runtime-exec' | |
| alias brc='brazil-recursive-cmd' | |
| alias bws='brazil ws' | |
| alias bwsuse='bws use -p' | |
| alias bwscreate='bws create -n' | |
| alias brc=brazil-recursive-cmd | |
| alias bbr='brc brazil-build' | |
| alias bball='brc --allPackages' | |
| alias bbb='brc --allPackages brazil-build' | |
| alias bbra='bbr apollo-pkg' | |
| ##### --------------------------------------------------------- | |
| ##### Git improvements | |
| ##### --------------------------------------------------------- | |
| # Faster git prompt through caching | |
| GIT_STATUS_CACHE_TIMEOUT=5 | |
| ##### --------------------------------------------------------- | |
| ##### Prompt | |
| ##### --------------------------------------------------------- | |
| # Clean, fast async Git prompt | |
| autoload -Uz vcs_info | |
| setopt prompt_subst | |
| precmd() { vcs_info } | |
| # Colors | |
| local R='%F{red}' | |
| local G='%F{green}' | |
| local B='%F{blue}' | |
| local Y='%F{yellow}' | |
| local W='%F{white}' | |
| local C='%F{cyan}' | |
| local RESET='%f' | |
| # Git status part | |
| zstyle ':vcs_info:git:*' formats "%{$C%}(%b)%{$RESET%}" | |
| zstyle ':vcs_info:*' enable git | |
| PROMPT=' | |
| %{$W%}@ARM %{$Y%}%~ %{$RESET%}${vcs_info_msg_0_} %{$W%}$ ' | |
| ##### --------------------------------------------------------- | |
| ##### Plugins (lightweight without frameworks) | |
| ##### --------------------------------------------------------- | |
| # zsh-autosuggestions | |
| if [[ -d ~/.zsh/zsh-autosuggestions ]]; then | |
| source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh | |
| fi | |
| # zsh-syntax-highlighting (must be last) | |
| if [[ -d ~/.zsh/zsh-syntax-highlighting ]]; then | |
| source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh | |
| fi | |
| # fzf bindings and auto-completion | |
| if [[ -f ~/.fzf.zsh ]]; then | |
| source ~/.fzf.zsh | |
| fi | |
| ##### --------------------------------------------------------- | |
| ##### FZF Integration (if installed) | |
| ##### --------------------------------------------------------- | |
| if command -v fzf >/dev/null 2>&1; then | |
| export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git' | |
| export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" | |
| export FZF_DEFAULT_OPTS='--height 40% --border' | |
| fi | |
| ##### --------------------------------------------------------- | |
| ##### Useful functions | |
| ##### --------------------------------------------------------- | |
| # Extract anything | |
| extract() { | |
| case "$1" in | |
| *.tar.bz2) tar xjf "$1" ;; | |
| *.tar.gz) tar xzf "$1" ;; | |
| *.zip) unzip "$1" ;; | |
| *.tar) tar xf "$1" ;; | |
| *.tgz) tar xzf "$1" ;; | |
| *) echo "Unknown format: $1" ;; | |
| esac | |
| } | |
| # Open a C++ file in $EDITOR using fzf | |
| copen() { | |
| local file | |
| file=$(fd -e cpp -e cc -e cxx -e h -e hpp -E build 2>/dev/null | fzf) || return | |
| "$EDITOR" "$file" | |
| } | |
| # Grep in C++ files with rg + fzf | |
| cgrep() { | |
| if [[ -z "$1" ]]; then | |
| echo "usage: cgrep <pattern>" | |
| return 1 | |
| fi | |
| rg "$1" --glob '*.{c,cc,cpp,cxx,h,hpp}' | fzf | |
| } | |
| # mkcd: make directory and cd | |
| mkcd() { mkdir -p "$1" && cd "$1"; } | |
| ##### --------------------------------------------------------- | |
| ##### End | |
| ##### --------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment