More tmux git status buginess, solved now I beleive.

This commit is contained in:
Aaron D. Lee
2025-12-14 15:13:40 -05:00
parent 059d68ae46
commit a2acf69a8a
4 changed files with 329 additions and 151 deletions

View File

@@ -1,5 +1,7 @@
#set-option -g default-shell /usr/bin/zsh # Update environment on attach
set -g default-command /usr/bin/zsh set-option -g update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
set -g default-shell /usr/bin/zsh
# Enable RGB colors if your terminal supports it # Enable RGB colors if your terminal supports it

View File

@@ -1,127 +1,290 @@
# If you come from bash you might have to change your $PATH. # ============================================================================
# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH # ADLee's ZSH Configuration
# ============================================================================
# Path to your Oh My Zsh installation. # Force proper initialization in tmux
if [[ -n "$TMUX" ]]; then
# Ensure oh-my-zsh paths are set
export ZSH="$HOME/.oh-my-zsh"
fi
# Path to oh-my-zsh installation
export ZSH="$HOME/.oh-my-zsh" export ZSH="$HOME/.oh-my-zsh"
# 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, # Path to oh-my-zsh installation
# to know which specific one was loaded, run: echo $RANDOM_THEME export ZSH="$HOME/.oh-my-zsh"
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
# ============================================================================
# Theme Configuration
# ============================================================================
ZSH_THEME="adlee" ZSH_THEME="adlee"
#zstyle ':omz:alpha:lib:git' async-prompt no # ============================================================================
# Oh-My-Zsh Settings
# ============================================================================
# Set list of themes to pick from when loading at random # Update behavior
# Setting this variable when ZSH_THEME=random will cause zsh to load zstyle ':omz:update' mode reminder
# a theme from this variable instead of looking in $ZSH/themes/ zstyle ':omz:update' frequency 13
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion. # Display red dots whilst waiting for completion
# CASE_SENSITIVE="true" COMPLETION_WAITING_DOTS="true"
# Uncomment the following line to use hyphen-insensitive completion. # History timestamp format
# Case-sensitive completion must be off. _ and - will be interchangeable. HIST_STAMPS="yyyy-mm-dd"
# HYPHEN_INSENSITIVE="true"
# Uncomment one of the following lines to change the auto-update behavior # ============================================================================
# zstyle ':omz:update' mode disabled # disable automatic updates # Plugins
# zstyle ':omz:update' mode auto # update automatically without asking # ============================================================================
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
# Uncomment the following line to change how often to auto-update (in days). plugins=(
# zstyle ':omz:update' frequency 13 git
docker
docker-compose
kubectl
sudo
fzf
zsh-autosuggestions
zsh-syntax-highlighting
)
# Uncomment the following line if pasting URLs and other text is messed up. # Note: Install additional plugins with:
# DISABLE_MAGIC_FUNCTIONS="true" # git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# Uncomment the following line to disable colors in ls. # ============================================================================
# DISABLE_LS_COLORS="true" # Load Oh-My-Zsh
# ============================================================================
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# You can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
# COMPLETION_WAITING_DOTS="true"
# 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"
# 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"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
source $ZSH/oh-my-zsh.sh source $ZSH/oh-my-zsh.sh
# ============================================================================
# User Configuration
# ============================================================================
# --- Environment Variables ---
# User configuration export EDITOR='vim'
export VISUAL='vim'
# export MANPATH="/usr/local/man:$MANPATH" # Language environment
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# You may need to manually set your language environment # Add local bin to PATH
# export LANG=en_US.UTF-8 export PATH="$HOME/.local/bin:$PATH"
# Preferred editor for local and remote sessions # --- Aliases ---
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='nvim'
# fi
# Compilation flags # Navigation
# export ARCHFLAGS="-arch $(uname -m)" alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias ~='cd ~'
# Set personal aliases, overriding those provided by Oh My Zsh libs, # List files
# plugins, and themes. Aliases can be placed here, though Oh My Zsh if command -v eza &> /dev/null; then
# users are encouraged to define aliases within a top-level file in alias ls='eza --icons'
# the $ZSH_CUSTOM folder, with .zsh extension. Examples: alias ll='eza -lah --icons'
# - $ZSH_CUSTOM/aliases.zsh alias la='eza -a --icons'
# - $ZSH_CUSTOM/macos.zsh alias lt='eza --tree --level=2 --icons'
# For a full list of active aliases, run `alias`. else
# alias ll='ls -lah'
# Example aliases alias la='ls -A'
# alias zshconfig="mate ~/.zshrc" fi
# alias ohmyzsh="mate ~/.oh-my-zsh"
alias vispresso="vim ~/.config/espanso/match/base.yml"
# GitHub token helper # Cat with syntax highlighting
gh-token-setup() { if command -v batcat &> /dev/null; then
echo "Enter your GitHub username:" alias cat='batcat --paging=never'
read gh_user alias bat='batcat'
echo "Enter your GitHub personal access token:" elif command -v bat &> /dev/null; then
read -s gh_token alias cat='bat --paging=never'
fi
git config --global credential.helper store # Git shortcuts
echo "https://${gh_user}:${gh_token}@github.com" > ~/.git-credentials alias g='git'
chmod 600 ~/.git-credentials alias gs='git status'
alias ga='git add'
alias gc='git commit'
alias gp='git push'
alias gl='git pull'
alias gd='git diff'
alias gco='git checkout'
alias gb='git branch'
alias glog='git log --oneline --graph --decorate --all'
echo "✓ GitHub token configured!" # Docker shortcuts
alias d='docker'
alias dc='docker-compose'
alias dps='docker ps'
alias dpa='docker ps -a'
alias di='docker images'
alias dex='docker exec -it'
# System shortcuts
alias reload='source ~/.zshrc'
alias zshconfig='vim ~/.zshrc'
alias themeconfig='vim ~/.oh-my-zsh/themes/adlee.zsh-theme'
alias h='history'
alias c='clear'
# Safe operations
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Network
alias myip='curl ifconfig.me'
alias ports='netstat -tulanp'
# --- Functions ---
# Create directory and cd into it
mkcd() {
mkdir -p "$1" && cd "$1"
} }
# Uncomment if you want any custom functions enabled. # Extract various archive formats
source $HOME/.dotfiles/zsh/functions/snapper.zsh extract() {
if [ -f "$1" ]; then
case "$1" in
*.tar.bz2) tar xjf "$1" ;;
*.tar.gz) tar xzf "$1" ;;
*.bz2) bunzip2 "$1" ;;
*.rar) unrar x "$1" ;;
*.gz) gunzip "$1" ;;
*.tar) tar xf "$1" ;;
*.tbz2) tar xjf "$1" ;;
*.tgz) tar xzf "$1" ;;
*.zip) unzip "$1" ;;
*.Z) uncompress "$1" ;;
*.7z) 7z x "$1" ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# Quick find file
ff() {
find . -type f -iname "*$1*"
}
# Quick find directory
fd() {
find . -type d -iname "*$1*"
}
# Quick backup
backup() {
cp "$1" "$1.backup-$(date +%Y%m%d-%H%M%S)"
}
# --- FZF Configuration ---
if command -v fzf &> /dev/null; then
# Use fd if available for better performance
if command -v fd &> /dev/null; then
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
fi
# FZF color scheme
export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border'
# CTRL-R for history search
bindkey '^R' fzf-history-widget
fi
# --- History Configuration ---
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.zsh_history
# Share history between sessions
setopt SHARE_HISTORY
setopt APPEND_HISTORY
setopt EXTENDED_HISTORY
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_FIND_NO_DUPS
setopt HIST_IGNORE_SPACE
# --- Key Bindings ---
# Bind Ctrl+Left/Right to move by word
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
# Bind Home/End keys
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
# Bind Delete key
bindkey "^[[3~" delete-char
# --- Custom Key Bindings ---
# Alt+R to reload zsh config
reload-zsh() {
source ~/.zshrc
echo "✓ zsh configuration reloaded"
zle reset-prompt
}
zle -N reload-zsh
bindkey "^[r" reload-zsh # Alt+R
# Alt+G to show git status
git-status-widget() {
echo
git status
zle reset-prompt
}
zle -N git-status-widget
bindkey "^[g" git-status-widget # Alt+G
# --- Application-Specific Settings ---
# Node Version Manager (if installed)
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
# Python virtual environment
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=$(which python3)
[ -f /usr/local/bin/virtualenvwrapper.sh ] && source /usr/local/bin/virtualenvwrapper.sh
# Rust cargo
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
# --- OS-Specific Configuration ---
case "$(uname -s)" in
Darwin*)
# macOS specific settings
export HOMEBREW_NO_ANALYTICS=1
;;
Linux*)
# Linux specific settings
;;
esac
# --- Snapper Functions ---
# Source snapper snapshot management functions
if [[ -f "$HOME/.dotfiles/zsh/functions/snapper.zsh" ]]; then
source "$HOME/.dotfiles/zsh/functions/snapper.zsh"
fi
# --- Local Configuration ---
# Load local configuration if it exists (for machine-specific settings)
[ -f ~/.zshrc.local ] && source ~/.zshrc.local
# ============================================================================
# End of Configuration
# ============================================================================

5
zsh/temp Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

View File

@@ -9,19 +9,17 @@
# ============================================================================ # ============================================================================
setopt PROMPT_SUBST setopt PROMPT_SUBST
# Ensure proper line handling in tmux
setopt PROMPT_CR setopt PROMPT_CR
setopt PROMPT_SP setopt PROMPT_SP
setopt TYPESET_SILENT setopt TYPESET_SILENT
export PROMPT_EOL_MARK='' export PROMPT_EOL_MARK=''
# Prevent multiple initialization on reload # Force color loading (critical for tmux)
if [[ -z "$_ADLEE_THEME_LOADED" || "$TERM" = 'tmux-256color' ]] ; then autoload -U colors && colors
export _ADLEE_THEME_LOADED=1
export KEYTIMEOUT=1 export KEYTIMEOUT=1
# Color definitions # Color definitions - always set these
typeset -g COLOR_GREY='%{$FG[239]%}' typeset -g COLOR_GREY='%{$FG[239]%}'
typeset -g COLOR_YELLOW='%{$FG[179]%}' typeset -g COLOR_YELLOW='%{$FG[179]%}'
typeset -g COLOR_BLUE='%{$FG[069]%}' typeset -g COLOR_BLUE='%{$FG[069]%}'
@@ -43,15 +41,24 @@ if [[ -z "$_ADLEE_THEME_LOADED" || "$TERM" = 'tmux-256color' ]] ; then
# Timer threshold (seconds) # Timer threshold (seconds)
typeset -g TIMER_THRESHOLD=10 typeset -g TIMER_THRESHOLD=10
fi
# ============================================================================ # ============================================================================
# GIT PROMPT CONFIGURATION # GIT PROMPT CONFIGURATION
# ============================================================================ # ============================================================================
ZSH_THEME_GIT_PROMPT_PREFIX="]─[%{$fg_bold[green]%}" # Force load git library for git_prompt_info
if [[ -f "$ZSH/lib/git.zsh" ]]; then
source "$ZSH/lib/git.zsh"
fi
#ZSH_THEME_GIT_PROMPT_PREFIX="]─[%{$fg_bold[green]%}"
#ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color$FG[239]%}"
#ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}"
#ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg_bold[green]%}⎇ "
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color$FG[239]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color$FG[239]%}"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}" ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*"
ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_CLEAN=""
# ============================================================================ # ============================================================================
@@ -130,25 +137,21 @@ _adlee_format_elapsed_time() {
# PROMPT BUILDING # PROMPT BUILDING
# ============================================================================ # ============================================================================
#_adlee_build_prompt() {
# local user_host="$(_adlee_format_user_host)" # Ensure git prompt function is available
# local directory="$(_adlee_format_directory)" if ! (( $+functions[git_prompt_info] )); then
# # Git lib not loaded yet, source it manually
# # Build top line: ┌[user@host]─[directory] source "$ZSH/lib/git.zsh" 2>/dev/null || true
# local top_line="${COLOR_GREY}┌[${user_host}]─[${directory}]" fi
#
# print -P "${top_line}"
#
# # Set bottom line prompt character
# PROMPT="$(_adlee_get_prompt_char)"
#}
#
_adlee_build_prompt() { _adlee_build_prompt() {
PROMPT="${COLOR_GREY}┌[${COLOR_GREEN}%n@%m${COLOR_RESET}${COLOR_GREY}]─[${COLOR_YELLOW}%~${COLOR_RESET}${COLOR_GREY}\$(git_prompt_info)${COLOR_GREY}] # Use direct color codes instead of variables in PROMPT
${COLOR_GREY}└${COLOR_BOLD}${COLOR_BLUE}%#${COLOR_RESET} " PROMPT='%{$FG[239]%}┌[%{$FG[118]%}%n@%m%{$reset_color$FG[239]%}]─[%{$FG[179]%}%~%{$reset_color$FG[239]%}$(git_prompt_info)%{$FG[239]%}]
%{$FG[239]%}└%{$FX[bold]$FG[069]%}%#%{$reset_color%} '
} }
# ============================================================================ # ============================================================================
# ZSH HOOKS # ZSH HOOKS
# ============================================================================ # ============================================================================
@@ -198,6 +201,11 @@ histsearch() {
# Load required functions # Load required functions
autoload -Uz add-zsh-hook autoload -Uz add-zsh-hook
# Force initial prompt build for tmux
if [[ -n "$TMUX" ]]; then
_adlee_build_prompt
fi
# Register hooks # Register hooks
add-zsh-hook preexec adlee_preexec add-zsh-hook preexec adlee_preexec
add-zsh-hook precmd adlee_precmd add-zsh-hook precmd adlee_precmd