zshの初期設定メモ(Mac)

Homebrewで入れる

❯ brew leaves awscli bat fd fzf git git-delta git-secrets jq lazygit mise ripgrep starship tree yq zoxide ❯ brew install --cask claude-code ❯ brew install --cask alfred ❯ brew install --cask font-meslo-lg-nerd-font

~/.zhrc

# ========================= # zinit # ========================= # git clone --depth=1 https://github.com/zdharma-continuum/zinit.git ~/.zinit/bin source ~/.zinit/bin/zinit.zsh autoload -Uz _zinit (( ${+_comps} )) && _comps[zinit]=_zinit # ========================= # Plugins # ========================= # autosuggestions(fish の灰色サジェスト) # zinit ice wait"0" lucid zinit light zsh-users/zsh-autosuggestions ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8' # syntax highlight(高速版) # zinit ice wait"0" lucid zinit light zdharma-continuum/fast-syntax-highlighting # 補完拡張 # zinit ice wait"0" lucid zinit light zsh-users/zsh-completions # ↑↓キーでコマンド履歴を部分一致検索できる zinit light zsh-users/zsh-history-substring-search # 補完の挙動を fish 寄せ zstyle ':completion:*' menu select zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' # ========================= # conf.d loader # ========================= CONF_DIR="$HOME/workspace/conf.d" if [[ -d "$CONF_DIR" ]]; then for f in "$CONF_DIR"/*; do if [[ "$f" == *.zsh ]]; then [[ -f "$f" ]] || continue [[ -x "$f" ]] || chmod a+x "$f" source "$f" fi done fi # brew install zoxide eval "$(zoxide init zsh)" # brew install starship # ~/.config/starship.toml eval "$(starship init zsh)" # brew install mise eval "$(mise activate zsh)" # brew install fzf source <(fzf --zsh) # brew install git-delta export DELTA_FEATURES=+side-by-side # ========================= # 他 # ========================= # 履歴設定 HISTFILE=~/.zsh_history HISTSIZE=10000 SAVEHIST=10000 setopt share_history # 複数のzshセッション間で履歴を共有 setopt hist_ignore_dups # 重複するコマンドを履歴に保存しない setopt hist_ignore_space # スペースで始まるコマンドを履歴に保存しない # ディレクトリ移動 setopt auto_cd # ディレクトリ名だけでcd setopt auto_pushd # cd時に自動でpushd setopt pushd_ignore_dups # 重複するディレクトリをスタックに追加しない # エイリアス alias ll='ls -lh' alias la='ls -lAh' alias ..='cd ..' alias ...='cd ../..' export CLICOLOR=1 # ========================= # auto generated by third-party libs # ========================= export PATH="$PATH:$HOME/.local/bin"

~/.config/starship.toml

プリセットの Tokyo Night ベース

"$schema" = 'https://starship.rs/config-schema.json' format = """ $directory\ [](fg:#769ff0 bg:#394260)\ $git_branch\ $git_status\ [](fg:#394260 bg:#212736)\ $nodejs\ $rust\ $golang\ [](fg:#212736 bg:#1d2230)\ $time\ [ ](fg:#1d2230) $status$cmd_duration\ $character""" [directory] style = "fg:#1d2230 bg:#769ff0" format = "[ $path ]($style)" truncation_length = 3 truncation_symbol = "…/" home_symbol = '󰋜' [directory.substitutions] "Documents" = "󰈙 " "Downloads" = " " "Music" = " " "Pictures" = " " [git_branch] symbol = "" style = "bg:#394260" format = '[[ $symbol $branch ](fg:#769ff0 bg:#394260)]($style)' [git_status] style = "bg:#394260" format = '[[($all_status$ahead_behind )](fg:#769ff0 bg:#394260)]($style)' [nodejs] symbol = "" style = "bg:#212736" format = '[[ $symbol ($version) ](fg:#769ff0 bg:#212736)]($style)' [rust] symbol = "" style = "bg:#212736" format = '[[ $symbol ($version) ](fg:#769ff0 bg:#212736)]($style)' [golang] symbol = "" style = "bg:#212736" format = '[[ $symbol ($version) ](fg:#769ff0 bg:#212736)]($style)' [time] disabled = false time_format = "%R" # Hour:Minute Format style = "bg:#1d2230" format = '[[  $time ](fg:#a0a9cb bg:#1d2230)]($style)'