├── zsh ├── alias.zsh ├── zinit.zsh ├── env.zsh ├── fzf.zsh ├── functions.zsh ├── plugins.zsh ├── functions │ └── repo.zsh ├── .zshrc ├── completion.zsh └── completions-lazy.zsh ├── .gitignore ├── scripts └── brew_dump.sh ├── Brewfile ├── gitconfig ├── starship └── starship.toml ├── install.sh ├── README.md └── AGENTS.md /zsh/alias.zsh: -------------------------------------------------------------------------------- 1 | alias ls='eza --icons=auto' 2 | -------------------------------------------------------------------------------- /zsh/zinit.zsh: -------------------------------------------------------------------------------- 1 | source /home/linuxbrew/.linuxbrew/opt/zinit/zinit.zsh 2 | 3 | # zinit turbo mode 4 | zinit ice wait'0' lucid 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Zsh 2 | .zcompdump 3 | .zcompdump-* 4 | 5 | # macOS 6 | .DS_Store 7 | 8 | # Editor 9 | .vscode/ 10 | .vim/ 11 | *.swp 12 | *.swo 13 | *~ 14 | -------------------------------------------------------------------------------- /zsh/env.zsh: -------------------------------------------------------------------------------- 1 | # Homebrew 2 | eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" 3 | 4 | if ! command -v devbox &> /dev/null; then 5 | curl -fsSL https://get.jetify.com/devbox | bash 6 | fi 7 | -------------------------------------------------------------------------------- /zsh/fzf.zsh: -------------------------------------------------------------------------------- 1 | # fzf integration (official) 2 | source <(fzf --zsh) 3 | 4 | # Ctrl-R options 5 | export FZF_CTRL_R_OPTS=" 6 | --height 40% 7 | --layout=reverse 8 | --border 9 | " 10 | -------------------------------------------------------------------------------- /scripts/brew_dump.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" 5 | REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" 6 | 7 | brew bundle dump --file "$REPO_ROOT/Brewfile" --force 8 | -------------------------------------------------------------------------------- /zsh/functions.zsh: -------------------------------------------------------------------------------- 1 | # ---------- functions ---------- 2 | # Load all function files from functions/ directory 3 | if [ -d "$ZDOTDIR/functions" ]; then 4 | for f in "$ZDOTDIR/functions"/*.zsh; do 5 | [ -f "$f" ] && source "$f" 6 | done 7 | fi 8 | -------------------------------------------------------------------------------- /zsh/plugins.zsh: -------------------------------------------------------------------------------- 1 | zinit light zsh-users/zsh-autosuggestions 2 | 3 | zinit light zsh-users/zsh-syntax-highlighting 4 | 5 | zinit light paulirish/git-open 6 | zinit light paulirish/git-recent 7 | 8 | zinit light junegunn/fzf 9 | zinit light Aloxaf/fzf-tab 10 | -------------------------------------------------------------------------------- /Brewfile: -------------------------------------------------------------------------------- 1 | brew "bat" 2 | brew "eza" 3 | brew "fzf" 4 | brew "gh" 5 | brew "ghq" 6 | brew "git" 7 | brew "starship" 8 | brew "zinit" 9 | vscode "github.copilot" 10 | vscode "github.copilot-chat" 11 | vscode "ms-ceintl.vscode-language-pack-ja" 12 | vscode "natqe.reload" 13 | -------------------------------------------------------------------------------- /zsh/functions/repo.zsh: -------------------------------------------------------------------------------- 1 | # Navigate to a local repository root using ghq and fzf 2 | function repo() { 3 | local repo_path=$(ghq list | fzf --prompt="Select repository: " --height=40% --reverse) 4 | if [ -n "$repo_path" ]; then 5 | cd "$(ghq root)/$repo_path" 6 | fi 7 | } 8 | -------------------------------------------------------------------------------- /zsh/.zshrc: -------------------------------------------------------------------------------- 1 | export ZDOTDIR="$HOME/.config/zsh" 2 | 3 | # ---------- modules ---------- 4 | for f in env zinit completion plugins completions-lazy fzf functions alias; do 5 | source "$ZDOTDIR/$f.zsh" 6 | done 7 | 8 | # ---------- prompt ---------- 9 | eval "$(starship init zsh)" 10 | -------------------------------------------------------------------------------- /zsh/completion.zsh: -------------------------------------------------------------------------------- 1 | # Homebrewの補完パスを追加 2 | if type brew &>/dev/null; then 3 | FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" 4 | fi 5 | 6 | # compinit を最適化(1日1回だけ再生成) 7 | autoload -Uz compinit 8 | if [[ -n ${ZDOTDIR}/.zcompdump(#qN.mh+24) ]]; then 9 | compinit 10 | else 11 | compinit -C 12 | fi 13 | 14 | zstyle ':completion:*' menu select 15 | zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' 16 | -------------------------------------------------------------------------------- /zsh/completions-lazy.zsh: -------------------------------------------------------------------------------- 1 | local -a completion_cmds=( 2 | 'gh completion -s zsh' 3 | 'devbox completion zsh' 4 | ) 5 | 6 | for cmd in "${completion_cmds[@]}"; do 7 | zinit ice wait lucid atload"eval \"\$($cmd)\"" 8 | zinit light zdharma-continuum/null 9 | done 10 | 11 | if type brew &>/dev/null; then 12 | zinit ice wait lucid as"completion" 13 | zinit snippet "$(brew --prefix)/share/zsh/site-functions/_ghq" 14 | fi 15 | -------------------------------------------------------------------------------- /gitconfig: -------------------------------------------------------------------------------- 1 | [user] 2 | name = irokaru 3 | email = karuta@nononotyaya.net 4 | 5 | [init] 6 | defaultBranch = main 7 | 8 | [core] 9 | editor = vim 10 | 11 | [push] 12 | default = current 13 | 14 | [pull] 15 | rebase = false 16 | 17 | [fetch] 18 | prune = true 19 | 20 | [alias] 21 | st = status 22 | sw = switch 23 | co = checkout 24 | br = branch 25 | ci = commit 26 | unstage = reset HEAD -- 27 | last = log -1 HEAD 28 | visual = log --graph --oneline --decorate --all 29 | -------------------------------------------------------------------------------- /starship/starship.toml: -------------------------------------------------------------------------------- 1 | add_newline = false 2 | 3 | format = "$directory$fill$git_branch$git_status$cmd_duration\n$character" 4 | 5 | right_format = """$golang\ 6 | $rust\ 7 | $nodejs\ 8 | $python\ 9 | $ruby""" 10 | 11 | [fill] 12 | symbol = " " 13 | 14 | [git_branch] 15 | symbol = "\uf113" 16 | format = "[$symbol $branch]($style) " 17 | 18 | [git_status] 19 | format = " [$all_status]($style)" 20 | style = "red" 21 | conflicted = "✖" 22 | ahead = "⇡" 23 | behind = "⇣" 24 | stashed = "" 25 | untracked = "?" 26 | staged = "+" 27 | modified = "!" 28 | renamed = "»" 29 | deleted = "✗" 30 | 31 | [character] 32 | format = "$symbol" 33 | success_symbol = "[❯](bold green) " 34 | error_symbol = "[❯](bold red) " 35 | vicmd_symbol = "[❯](bold yellow) " 36 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" 5 | 6 | # install 7 | sudo apt update && sudo apt install -y \ 8 | build-essential \ 9 | curl \ 10 | file \ 11 | git \ 12 | procps \ 13 | ca-certificates && \ 14 | sudo apt autoremove -y 15 | 16 | # Create symbolic links for configuration files 17 | mkdir -p ~/.config 18 | mkdir -p ~/.config/git 19 | ln -sfnT "${CURRENT_DIR}/zsh" ~/.config/zsh 20 | ln -sfnT "${CURRENT_DIR}/zsh/.zshrc" ~/.zshrc 21 | ln -sfnT "${CURRENT_DIR}/starship/starship.toml" ~/.config/starship.toml 22 | ln -sfnT "${CURRENT_DIR}/gitconfig" ~/.config/git/config 23 | 24 | # Install Homebrew and dependencies from Brewfile 25 | if ! command -v brew >/dev/null; then 26 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 27 | fi 28 | brew bundle --file "$CURRENT_DIR/Brewfile" 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dotfiles for WSL2 2 | 3 | 個人の zsh/starship 設定ファイル集です。 4 | 5 | ## Features 6 | 7 | - **zsh** - インタラクティブシェルの設定 8 | - zinit によるプラグイン管理 9 | - lazy loading による起動速度の最適化 10 | - gh, ghq などのコマンド補完 11 | 12 | - **starship** - クロスプラットフォームのモダンシェルプロンプト 13 | 14 | - **Homebrew** - macOS/Linux のパッケージ管理 15 | 16 | - **Git** - git 設定ファイル管理 17 | 18 | ## Installation 19 | 20 | ```bash 21 | # 1. リポジトリのクローン 22 | git clone https://github.com/irokaru/dotfiles.git 23 | cd dotfiles 24 | 25 | # 2. インストールスクリプトを実行 26 | ./install.sh 27 | 28 | # 3. シェルを再起動 29 | exec zsh 30 | ``` 31 | 32 | 詳細は [install.sh](install.sh) を参照してください。 33 | 34 | ## File Structure 35 | 36 | ``` 37 | dotfiles/ 38 | ├── Brewfile # Homebrew パッケージ定義 39 | ├── gitconfig # Git 設定 40 | ├── install.sh # インストールスクリプト 41 | ├── README.md # このファイル 42 | ├── AGENTS.md # AIエージェント向けドキュメント 43 | ├── scripts/ 44 | │ └── brew_dump.sh # Brewfile 更新スクリプト 45 | ├── starship/ 46 | │ └── starship.toml # starship プロンプト設定 47 | └── zsh/ 48 | ├── .zshrc # zsh メイン設定 49 | ├── env.zsh # 環境変数 50 | ├── zinit.zsh # zinit の初期化 51 | ├── plugins.zsh # プラグイン管理 52 | ├── completion.zsh # 基本補完設定 53 | ├── completions-lazy.zsh # 遅延補完読み込み 54 | ├── fzf.zsh # fzf キーバインド 55 | └── alias.zsh # エイリアス設定 56 | ``` 57 | 58 | ## Requirements 59 | 60 | - zsh 5.0+ 61 | - Homebrew 62 | 63 | ## License 64 | 65 | MIT 66 | -------------------------------------------------------------------------------- /AGENTS.md: -------------------------------------------------------------------------------- 1 | # AGENTS.md 2 | 3 | This is a dotfiles repository for personal zsh/starship configuration. 4 | 5 | ## Project Overview 6 | 7 | - Personal shell configuration and package management setup 8 | - Optimized startup performance with lazy loading 9 | - Cross-platform compatibility (macOS/Linux) 10 | - Focus on modern CLI tools: gh, ghq, fzf, starship 11 | 12 | ## Setup Commands 13 | 14 | ### Initial Setup 15 | 16 | ```bash 17 | # Clone the repository 18 | git clone https://github.com/irokaru/dotfiles.git 19 | cd dotfiles 20 | 21 | # Run the installation script 22 | ./install.sh 23 | 24 | # Reload shell 25 | exec zsh 26 | ``` 27 | 28 | ### Install Script Details 29 | 30 | The `install.sh` script performs: 31 | 1. Updates system packages (apt on Linux) 32 | 2. Creates symbolic links for configuration files 33 | 3. Installs Homebrew if not present 34 | 4. Installs all packages defined in Brewfile 35 | 36 | ### Managing Brewfile 37 | 38 | To sync Brewfile with currently installed packages: 39 | 40 | ```bash 41 | ./scripts/brew_dump.sh 42 | ``` 43 | 44 | This will overwrite the Brewfile with your current Homebrew installations. Useful when you install a new package and want to persist it to the dotfiles. 45 | 46 | ### Verify Setup 47 | 48 | ```bash 49 | # Reload shell configuration 50 | exec zsh 51 | 52 | # Check if all plugins are loaded 53 | zinit list 54 | ``` 55 | 56 | ## Key Configuration Files 57 | 58 | ### zsh/.zshrc 59 | - Main zsh configuration file 60 | - Loads all modules in order: env → zinit → completion → plugins → completions-lazy → fzf → alias 61 | - Sets ZDOTDIR to ~/.config/zsh 62 | 63 | ### zsh/completion.zsh 64 | - Basic completion setup 65 | - Homebrew site-functions path configuration 66 | - compinit with 24-hour cache optimization 67 | 68 | ### zsh/completions-lazy.zsh 69 | - Lazy-loaded completions for gh (GitHub CLI) 70 | - Lazy-loaded completions for ghq (Git repository manager) 71 | - Uses zinit turbo mode for performance 72 | 73 | ### starship/starship.toml 74 | - Cross-platform shell prompt configuration 75 | - Customizable module settings 76 | 77 | ### Brewfile 78 | - Homebrew package definitions 79 | - Includes: bat, eza, fzf, gh, ghq, git, starship, zinit 80 | 81 | ### gitconfig 82 | - Git configuration with user settings (irokaru / karuta@nononotyaya.net) 83 | - Default branch: main 84 | - Pull strategy: no rebase 85 | - Useful aliases included 86 | 87 | ## Development Notes 88 | 89 | ### Managing Packages 90 | 91 | 1. Install a new package: `brew install ` 92 | 2. Update Brewfile: `./scripts/brew_dump.sh` 93 | 3. Commit the changes: `git add Brewfile && git commit` 94 | 95 | This ensures all team members and systems stay synchronized. 96 | 97 | ### Adding New Completions 98 | 99 | 1. If the tool is installed via Homebrew and provides completion files, add to `zsh/completions-lazy.zsh` 100 | 2. Use `zinit ice wait lucid` for lazy loading 101 | 3. Test with `exec zsh` and verify completion with ` ` 102 | 103 | ### Modifying Plugins 104 | 105 | - Edit `zsh/plugins.zsh` to add/remove zinit plugins 106 | - Reload with `exec zsh` to test 107 | 108 | ### Optimizing Startup Time 109 | 110 | - The .zcompdump cache file is generated in ~/.config/zsh/ 111 | - It's gitignored and regenerated daily for performance 112 | - Check .gitignore for excluded files 113 | 114 | ## Testing Instructions 115 | 116 | ```bash 117 | # Source the configuration without spawning a new shell 118 | source ~/.config/zsh/.zshrc 119 | 120 | # List all loaded zinit plugins 121 | zinit list 122 | 123 | # Check if gh completion works 124 | gh 125 | 126 | # Check if ghq completion works 127 | ghq 128 | 129 | # Verify fzf integration 130 | Ctrl+R # Should open fzf history search 131 | ``` 132 | 133 | ## Troubleshooting 134 | 135 | ### Completions not working 136 | 137 | 1. Verify Homebrew installation: `brew --prefix` 138 | 2. Check if completion files exist: `ls $(brew --prefix)/share/zsh/site-functions/` 139 | 3. Reload with `exec zsh` and test 140 | 141 | ### Slow startup 142 | 143 | 1. Check .zcompdump age: `ls -l ~/.config/zsh/.zcompdump` 144 | 2. Delete old cache to force regeneration: `rm ~/.config/zsh/.zcompdump*` 145 | 3. Profile startup: `time zsh -i -c exit` 146 | 147 | ## Security Considerations 148 | 149 | - No sensitive data (API keys, tokens) in configuration files 150 | - All secrets should be stored in separate files not tracked by git 151 | - Review Brewfile before running `brew bundle install` to ensure you trust all packages 152 | 153 | ## Contributing 154 | 155 | This is a personal dotfiles repository. Feel free to fork and adapt for your own setup. 156 | 157 | ## License 158 | 159 | MIT 160 | --------------------------------------------------------------------------------