Created
April 8, 2026 11:26
-
-
Save hanjae-jea/d786fa59c782456e1ade12c476c54c49 to your computer and use it in GitHub Desktop.
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
| # Kiro CLI pre block. Keep at the top of this file. | |
| [[ -f "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.pre.zsh" ]] && builtin source "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.pre.zsh" | |
| # If you come from bash you might have to change your $PATH. | |
| # export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH | |
| # Path to your Oh My Zsh installation. | |
| 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, | |
| # to know which specific one was loaded, run: echo $RANDOM_THEME | |
| # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes | |
| ZSH_THEME="robbyrussell" | |
| # Set list of themes to pick from when loading at random | |
| # Setting this variable when ZSH_THEME=random will cause zsh to load | |
| # a theme from this variable instead of looking in $ZSH/themes/ | |
| # 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. | |
| # CASE_SENSITIVE="true" | |
| # Uncomment the following line to use hyphen-insensitive completion. | |
| # Case-sensitive completion must be off. _ and - will be interchangeable. | |
| # HYPHEN_INSENSITIVE="true" | |
| # Uncomment one of the following lines to change the auto-update behavior | |
| # zstyle ':omz:update' mode disabled # disable automatic updates | |
| # 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). | |
| # zstyle ':omz:update' frequency 13 | |
| # Uncomment the following line if pasting URLs and other text is messed up. | |
| # DISABLE_MAGIC_FUNCTIONS="true" | |
| # Uncomment the following line to disable colors in ls. | |
| # DISABLE_LS_COLORS="true" | |
| # 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=() | |
| source $ZSH/oh-my-zsh.sh | |
| # User configuration | |
| # export MANPATH="/usr/local/man:$MANPATH" | |
| # You may need to manually set your language environment | |
| # export LANG=en_US.UTF-8 | |
| # Preferred editor for local and remote sessions | |
| # if [[ -n $SSH_CONNECTION ]]; then | |
| # export EDITOR='vim' | |
| # else | |
| # export EDITOR='nvim' | |
| # fi | |
| # Compilation flags | |
| # export ARCHFLAGS="-arch $(uname -m)" | |
| # 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 a top-level file in | |
| # the $ZSH_CUSTOM folder, with .zsh extension. Examples: | |
| # - $ZSH_CUSTOM/aliases.zsh | |
| # - $ZSH_CUSTOM/macos.zsh | |
| # For a full list of active aliases, run `alias`. | |
| # | |
| # Example aliases | |
| # alias zshconfig="mate ~/.zshrc" | |
| # alias ohmyzsh="mate ~/.oh-my-zsh" | |
| alias ls="eza --icons" | |
| alias ll="eza -al --icons" | |
| source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh | |
| export CPPFLAGS="-I/opt/homebrew/opt/openjdk/include:$CPPFLAGS" | |
| export PATH="/opt/homebrew/opt/openjdk/bin:$PATH" | |
| function _gum_git_style_line() { | |
| local git_status="$1" | |
| local filepath_raw="$2" | |
| local filename | |
| if [[ "$git_status" == "R " ]]; then | |
| filename=$(basename "$(echo "$filepath_raw" | awk -F ' -> ' '{print $2}')") | |
| else | |
| filename=$(basename "$filepath_raw") | |
| fi | |
| local extension="${filename##*.}" | |
| local lc_extension=${(L)extension} | |
| local icon="" | |
| case "$filename" in | |
| "Dockerfile") icon="";; | |
| ".gitignore") icon="";; | |
| *) | |
| case "$lc_extension" in | |
| "js"|"mjs"|"cjs") icon="";; | |
| "ts"|"tsx") icon="";; | |
| "java") icon="";; | |
| "py") icon="";; | |
| "go") icon="";; | |
| "rb") icon="";; | |
| "php") icon="";; | |
| "html") icon="";; | |
| "css") icon="";; | |
| "scss"|"sass") icon="";; | |
| "md") icon="";; | |
| "json") icon="";; | |
| "yml"|"yaml") icon="";; | |
| "sh"|"zsh"|"bash")icon="";; | |
| "zip"|"gz"|"tar") icon="";; | |
| "png"|"jpg"|"jpeg"|"gif") icon="";; | |
| *) icon="";; | |
| esac;; | |
| esac | |
| local color="240" # Default grey | |
| # Staged files get a brighter color | |
| case "$git_status" in | |
| "M ") color="46";; # Green | |
| "A ") color="46";; # Green | |
| "D ") color="196";; # Red | |
| "R ") color="201";; # Magenta | |
| # Unstaged files get a slightly dimmer/different color | |
| " M") color="218";; # Pink | |
| " D") color="196";; # Red | |
| "??") color="220";; # Yellow | |
| esac | |
| # Print the final formatted string | |
| printf "%s %-2s %s" "$(gum style --foreground "$color" "${git_status}")" "$icon" "$(gum style --foreground "$color" "${filepath_raw}")" #"$filepath_raw" | |
| } | |
| # gss: Git Status Styled | |
| function gss() { | |
| # Exit if not in a git repository. | |
| if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1; then | |
| echo "Not a git repository." | |
| return 1 | |
| fi | |
| local staged_lines=() | |
| local unstaged_lines=() | |
| while IFS= read -r line; do | |
| if [[ -z "$line" ]]; then continue; fi | |
| local git_status="${line:0:2}" | |
| local filepath_raw="${line:3}" | |
| if [[ "$git_status" =~ ^[MADR] ]]; then | |
| staged_lines+=("$(_gum_git_style_line "$git_status" "$filepath_raw")") | |
| else | |
| unstaged_lines+=("$(_gum_git_style_line "$git_status" "$filepath_raw")") | |
| fi | |
| done <<< "$(git status --porcelain)" | |
| local all_display_lines=() | |
| if (( ${#staged_lines[@]} > 0 )); then | |
| all_display_lines+=("$(gum style --bold --foreground 46 'Staged Changes:')") | |
| all_display_lines+=("${staged_lines[@]}") | |
| fi | |
| if (( ${#unstaged_lines[@]} > 0 )); then | |
| (( ${#staged_lines[@]} > 0 )) && all_display_lines+=("") | |
| all_display_lines+=("$(gum style --bold --foreground 220 'Unstaged Changes:')") | |
| all_display_lines+=("${unstaged_lines[@]}") | |
| fi | |
| gum style --border normal --border-foreground 212 --padding "0 1" "${all_display_lines[@]}" | |
| } | |
| function gaa() { | |
| # Git 저장소가 아니거나 변경 사항이 없으면 종료합니다. | |
| if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1 || [[ -z $(git status --porcelain) ]]; then | |
| echo "No changes to add." | |
| return 0 | |
| fi | |
| # --- 변경 상태 표시 --- | |
| local staged_lines=() | |
| local unstaged_lines=() | |
| while IFS= read -r line; do | |
| if [[ -z "$line" ]]; then continue; fi | |
| local git_status="${line:0:2}" | |
| local filepath_raw="${line:3}" | |
| # 공통 스타일 함수를 호출합니다. | |
| if [[ "$git_status" =~ ^[MADR] ]]; then | |
| staged_lines+=("$(_gum_git_style_line "$git_status" "$filepath_raw")") | |
| else | |
| unstaged_lines+=("$(_gum_git_style_line "$git_status" "$filepath_raw")") | |
| fi | |
| done <<< "$(git status --porcelain)" | |
| # 헤더와 함께 최종 뷰 조립 | |
| local all_display_lines=() | |
| if (( ${#staged_lines[@]} > 0 )); then | |
| all_display_lines+=("$(gum style --bold --foreground 46 'Staged Changes:')") | |
| all_display_lines+=("${staged_lines[@]}") | |
| fi | |
| if (( ${#unstaged_lines[@]} > 0 )); then | |
| (( ${#staged_lines[@]} > 0 )) && all_display_lines+=("") | |
| all_display_lines+=("$(gum style --bold --foreground 220 'Unstaged Changes:')") | |
| all_display_lines+=("${unstaged_lines[@]}") | |
| fi | |
| gum style --border normal --border-foreground 212 --padding "0 1" "${all_display_lines[@]}" | |
| # --- Staging 처리 --- | |
| # Unstaged 파일이 있을 경우에만 확인 절차를 진행합니다. | |
| if (( ${#unstaged_lines[@]} > 0 )); then | |
| if gum confirm "Stage all unstaged changes?"; then | |
| git add . | |
| gum style --bold --foreground 46 "✅ All unstaged changes have been staged." | |
| else | |
| echo "Operation cancelled." | |
| return 1 | |
| fi | |
| else | |
| # Unstaged 파일이 없고 Staged 파일만 있는 경우 | |
| echo "No unstaged changes to add." | |
| fi | |
| } | |
| function gcm() { | |
| # Exit if not in a git repository or if there are no changes. | |
| if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1 || [[ -z $(git status --porcelain) ]]; then | |
| echo "No changes to commit." | |
| return 0 | |
| fi | |
| # Helper function to generate a single styled line. | |
| # This avoids code duplication between the status display and the chooser. | |
| # --- Main Status Display --- | |
| local staged_lines=() | |
| local unstaged_lines=() | |
| while IFS= read -r line; do | |
| if [[ -z "$line" ]]; then continue; fi | |
| local git_status="${line:0:2}" | |
| local filepath_raw="${line:3}" | |
| # Sort files into staged or unstaged based on the status code format | |
| if [[ "$git_status" =~ ^[MADR] ]]; then | |
| staged_lines+=("$(_gum_git_style_line "$git_status" "$filepath_raw")") | |
| else | |
| unstaged_lines+=("$(_gum_git_style_line "$git_status" "$filepath_raw")") | |
| fi | |
| done <<< "$(git status --porcelain)" | |
| # Assemble the final view with headers | |
| local all_display_lines=() | |
| if (( ${#staged_lines[@]} > 0 )); then | |
| all_display_lines+=("$(gum style --bold --foreground 46 'Staged Changes:')") | |
| all_display_lines+=("${staged_lines[@]}") | |
| fi | |
| if (( ${#unstaged_lines[@]} > 0 )); then | |
| # Add a spacer if there were staged files | |
| (( ${#staged_lines[@]} > 0 )) && all_display_lines+=("") | |
| all_display_lines+=("$(gum style --bold --foreground 220 'Unstaged Changes:')") | |
| all_display_lines+=("${unstaged_lines[@]}") | |
| fi | |
| gum style --border normal --border-foreground 212 --padding "0 1" "${all_display_lines[@]}" | |
| # --- Staging Process --- | |
| if (( ${#unstaged_lines[@]} > 0 )); then | |
| gum confirm "Stage all unstaged changes?" | |
| local confirm_status=$? | |
| if [[ $confirm_status -eq 0 ]]; then | |
| git add . | |
| elif [[ $confirm_status -eq 1 ]]; then | |
| # --- Styled File Selection --- | |
| local selected_styled_lines | |
| # Use the same styled lines from the status display as options for `gum choose` | |
| selected_styled_lines=$(printf "%s\n" "${unstaged_lines[@]}" | gum choose --no-limit --selected.foreground="46") || { echo "Operation cancelled."; return 1; } | |
| if [[ -n "$selected_styled_lines" ]]; then | |
| # Extract the raw file paths from the selected styled lines to pass to `git add` | |
| local files_to_add | |
| files_to_add=$(echo "$selected_styled_lines" | awk '{ $1=$2=""; print $0 }' | sed 's/^[ \t]*//') | |
| echo "$files_to_add" | xargs git add | |
| fi | |
| else | |
| echo "Operation cancelled." | |
| return 1 | |
| fi | |
| fi | |
| if git diff --staged --quiet; then | |
| echo "No changes staged for commit." | |
| return 1 | |
| fi | |
| # --- Commit Message Process --- | |
| local chosen_type | |
| chosen_type=$(gum choose \ | |
| "✨ feat: 새로운 기능 추가" \ | |
| "🐛 fix: 버그 수정" \ | |
| "📝 docs: 문서 수정" \ | |
| "🎨 style: 코드 포맷팅, 세미콜론 누락 등" \ | |
| "♻️ refactor: 코드 리팩토링" \ | |
| "⚡️ perf: 성능 개선" \ | |
| "✅ test: 테스트 코드 추가/수정" \ | |
| "🚀 chore: 빌드, 패키지 매니저 설정 등") || return 1 | |
| local TYPE | |
| TYPE=$(echo "$chosen_type" | awk -F': ' '{print $1}') | |
| local SUBJECT | |
| SUBJECT=$(gum input --placeholder "커밋 제목") || return 1 | |
| if [[ -z "$SUBJECT" ]]; then | |
| echo "Aborted: commit subject cannot be empty." | |
| return 1 | |
| fi | |
| local BODY | |
| BODY=$(gum write --placeholder "자세한 설명 (Ctrl+D 또는 Esc로 완료)") || return 1 | |
| if [[ -z "$BODY" ]]; then | |
| git commit -m "$TYPE: $SUBJECT" | |
| else | |
| git commit -m "$TYPE: $SUBJECT" -m "$BODY" | |
| fi | |
| } | |
| # Kiro CLI post block. Keep at the bottom of this file. | |
| [[ -f "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.post.zsh" ]] && builtin source "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.post.zsh" | |
| # Added by Antigravity | |
| export PATH="/Users/hanjae/.antigravity/antigravity/bin:$PATH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment