diff --git a/.zshrc b/.zshrc index 2ac1866..8652aec 100644 --- a/.zshrc +++ b/.zshrc @@ -3,7 +3,7 @@ # Source plugin initializations (keep at top) # Initialize zsh plugins and theme settings -source ~/.oh-my-posh-theme.json +source $OH_MY_POSH_THEME source ~/zsh/plugins.zsh # Source all modular files in appropriate order diff --git a/cloud-init.yaml b/cloud-init.yaml index 422807c..d013928 100644 --- a/cloud-init.yaml +++ b/cloud-init.yaml @@ -20,7 +20,8 @@ runcmd: - chsh -s /bin/zsh ubuntu - curl -s https://ohmyposh.dev/install.sh | bash -s - sudo snap install nushell --classic - - git clone https://github.com/unitz007/dotfiles.git /home/ubuntu/dotfiles + # DOTFILES_REPO env var should be used here instead of hardcoded URL + - git clone $DOTFILES_REPO /home/ubuntu/dotfiles - cp /home/ubuntu/dotfiles/.zshrc /home/ubuntu/ - cp /home/ubuntu/dotfiles/.oh-my-posh-theme.json /home/ubuntu/ - echo 'exec zsh' >> /home/ubuntu/.bashrc \ No newline at end of file diff --git a/fzf/.fzf.zsh b/fzf/.fzf.zsh index 6cc07fc..4c23f52 100644 --- a/fzf/.fzf.zsh +++ b/fzf/.fzf.zsh @@ -38,15 +38,13 @@ if command -v fzf &>/dev/null; then " # --- Source fzf keybindings and completion --- - if [[ -d "/opt/homebrew/opt/fzf/shell" ]]; then - source "/opt/homebrew/opt/fzf/shell/key-bindings.zsh" - source "/opt/homebrew/opt/fzf/shell/completion.zsh" - elif [[ -d "/usr/local/opt/fzf/shell" ]]; then - source "/usr/local/opt/fzf/shell/key-bindings.zsh" - source "/usr/local/opt/fzf/shell/completion.zsh" - elif [[ -d "$HOME/.fzf/shell" ]]; then - source "$HOME/.fzf/shell/key-bindings.zsh" - source "$HOME/.fzf/shell/completion.zsh" + # Use dynamic detection of fzf installation path + if command -v fzf >/dev/null 2>&1; then + local fzf_base="$(dirname $(dirname $(command -v fzf)))" + if [[ -d "$fzf_base/shell" ]]; then + source "$fzf_base/shell/key-bindings.zsh" + source "$fzf_base/shell/completion.zsh" + fi fi -fi +fi \ No newline at end of file diff --git a/macos-defaults.sh b/macos-defaults.sh index 70886e0..4abd621 100755 --- a/macos-defaults.sh +++ b/macos-defaults.sh @@ -44,8 +44,8 @@ apply_defaults "Hide icons on Desktop" com.apple.finder CreateDesktop -bool fals killall Finder || true # ── Screenshots ───────────────────────────────────────────────────────────── -mkdir -p ~/Screenshots -apply_defaults "Set screenshot save location to ~/Screenshots" com.apple.screencapture location -string "$HOME/Screenshots" +mkdir -p $SCREENSHOT_DIR +apply_defaults "Set screenshot save location to $SCREENSHOT_DIR" com.apple.screencapture location -string "$SCREENSHOT_DIR" apply_defaults "Set screenshot format to PNG" com.apple.screencapture type -string "png" killall SystemUIServer || true @@ -66,4 +66,4 @@ echo "✅ macOS defaults applied successfully." echo "⚠️ Some changes require logging out and back in (or restarting) to take full effect." echo " At minimum, restart Dock and Finder (already done)." -exit 0 +exit 0 \ No newline at end of file diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index a415ce9..b8afacd 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,29 +1,30 @@ # Aliases -alias ls="nu -c ls" -alias la="nu -c 'ls -la'" +if command -v nu >/dev/null 2>&1; then + alias ls="nu -c ls" + alias la="nu -c 'ls -la'" +else + alias ls="ls" + alias la="ls -la" +fi alias run="sdlc run" alias tst="sdlc test" alias build="sdlc build" alias vim=nvim alias vi=nvim -alias update="brew update && brew upgrade && brew cleanup" +alias update="brew update && brew upgrade && brew cleanup && echo '✅ Brew update complete' || echo '❌ Brew update failed'" alias k=kubectl alias kgs="kubectl get services" alias kgp="kubectl get pods" alias kgd="kubectl get deployments" alias ka="kubectl apply -f" -alias kd="kubectl delete" -alias pull="git pull" +alias kd="kubectl delete --wait" +alias gpl="git pull" alias g="git" -alias gc="git checkout" +alias gco="git checkout" alias ..="cd ../" alias ...="cd ../../" alias ....="cd ../../../" alias cls='clear' -alias tf=terraform -alias tfp="terraform plan" -alias tfa="tf apply" -alias gwp="cd ~/Personal/Golang" # Golang workspace alias h="cd ~/" alias nf=neofetch @@ -35,11 +36,21 @@ alias gs='git status' alias ga='git add' alias gm='git commit -m' alias gp='git push' +alias gb="git branch" +alias glog="git log --oneline --graph --decorate --all" # System monitoring alias df='df -h' alias du='du -h' -alias ps='ps aux' +alias psa='ps aux' # Networking -alias ports='netstat -tulanp' \ No newline at end of file +alias ports='netstat -tulanp' + +# Personal workspace +gwp() { cd $GOWORK 2>/dev/null || echo "⚠️ Golang workspace not found at $GOWORK"; } + +# Docker +alias d="docker" +alias dc="docker compose" +alias dkx="docker exec -it" \ No newline at end of file diff --git a/zsh/exports.zsh b/zsh/exports.zsh index 16f798c..ef012dd 100644 --- a/zsh/exports.zsh +++ b/zsh/exports.zsh @@ -1,4 +1,20 @@ # Environment variable exports export KUBE_EDITOR="nvim" export VISUAL=nvim -export LANG=en_US.UTF-8 \ No newline at end of file +export LANG=en_US.UTF-8 + +# New environment variables with defaults +: ${GOWORK:=$HOME/Personal/Golang} +export GOWORK + +: ${CLOUD_INIT_PATH:=$HOME/cloud-init.yaml} +export CLOUD_INIT_PATH + +: ${OH_MY_POSH_THEME:=$HOME/.oh-my-posh-theme.json} +export OH_MY_POSH_THEME + +: ${DOTFILES_REPO:=https://github.com/unitz007/dotfiles.git} +export DOTFILES_REPO + +: ${SCREENSHOT_DIR:=$HOME/Screenshots} +export SCREENSHOT_DIR \ No newline at end of file diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 488d955..e6773e3 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -44,7 +44,7 @@ ustart() { return 1 fi - multipass launch -n ubuntu --cpus 4 --disk 20G --memory 2G --cloud-init ~/cloud-init.yaml + multipass launch -n ubuntu --cpus 4 --disk 20G --memory 2G --cloud-init $CLOUD_INIT_PATH multipass shell ubuntu } diff --git a/zsh/plugins.zsh b/zsh/plugins.zsh index eb79bf5..b0d6f78 100644 --- a/zsh/plugins.zsh +++ b/zsh/plugins.zsh @@ -1,5 +1,5 @@ # Plugin initialization -eval "$(oh-my-posh init zsh --config ~/.oh-my-posh-theme.json)" +eval "$(oh-my-posh init zsh --config $OH_MY_POSH_THEME)" # Amazon Q pre block. Keep at the top of this file. [[ -f "${HOME}/Library/Application Support/amazon-q/shell/zshrc.pre.zsh" ]] && builtin source "${HOME}/Library/Application Support/amazon-q/shell/zshrc.pre.zsh"