Skip to content

Commit 181e35b

Browse files
committed
feat: add zsh with fish-like configuration
- zsh with autosuggestions and syntax highlighting - Starship prompt with git status - Advanced completion and fish-like keybindings - Set zsh as default shell in containers
1 parent d5ad5a8 commit 181e35b

4 files changed

Lines changed: 101 additions & 5 deletions

File tree

.devcontainer/base-with-bmad/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"anthropic.claude-code"
2525
],
2626
"settings": {
27-
"terminal.integrated.defaultProfile.linux": "bash"
27+
"terminal.integrated.defaultProfile.linux": "zsh"
2828
}
2929
}
3030
},

.devcontainer/base/Dockerfile

Lines changed: 90 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2222
git \
2323
sudo \
2424
openssh-client \
25+
# Shell et plugins
26+
zsh \
27+
zsh-autosuggestions \
28+
zsh-syntax-highlighting \
2529
# Outils d'analyse et debug
2630
ripgrep \
2731
fd-find \
@@ -41,9 +45,12 @@ RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | d
4145
&& apt-get install -y gh \
4246
&& rm -rf /var/lib/apt/lists/*
4347

44-
# Création de l'utilisateur non-root
48+
# Installation de Starship (prompt moderne)
49+
RUN curl -fsSL https://starship.rs/install.sh | sh -s -- -y
50+
51+
# Création de l'utilisateur non-root avec zsh
4552
RUN groupadd --gid $USER_GID $USERNAME \
46-
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
53+
&& useradd --uid $USER_UID --gid $USER_GID -m -s /bin/zsh $USERNAME \
4754
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
4855
&& chmod 0440 /etc/sudoers.d/$USERNAME
4956

@@ -54,7 +61,87 @@ RUN curl -fsSL https://claude.ai/install.sh | bash
5461
RUN mkdir -p /home/$USERNAME/.claude && \
5562
chown -R $USERNAME:$USERNAME /home/$USERNAME/.claude
5663

64+
# Configuration zsh pour l'utilisateur
65+
RUN cat <<'EOF' > /home/$USERNAME/.zshrc
66+
# Historique
67+
HISTFILE=~/.zsh_history
68+
HISTSIZE=10000
69+
SAVEHIST=10000
70+
setopt SHARE_HISTORY
71+
setopt HIST_IGNORE_DUPS
72+
setopt HIST_IGNORE_SPACE
73+
74+
# Navigation style fish
75+
setopt AUTO_CD
76+
setopt AUTO_PUSHD
77+
setopt PUSHD_IGNORE_DUPS
78+
setopt CORRECT
79+
80+
# Complétion avancée
81+
autoload -Uz compinit && compinit
82+
zstyle ':completion:*' menu select
83+
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
84+
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
85+
86+
# Plugins (autosuggestions + syntax highlighting)
87+
source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
88+
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
89+
90+
# Couleur des suggestions (gris clair)
91+
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=244'
92+
93+
# Raccourcis clavier style fish
94+
bindkey '^[[A' history-search-backward
95+
bindkey '^[[B' history-search-forward
96+
bindkey '^[[1;5C' forward-word
97+
bindkey '^[[1;5D' backward-word
98+
bindkey '^[[H' beginning-of-line
99+
bindkey '^[[F' end-of-line
100+
bindkey '^[[3~' delete-char
101+
bindkey '^ ' autosuggest-accept
102+
103+
# Aliases utiles
104+
alias ls='ls --color=auto'
105+
alias ll='ls -lah'
106+
alias la='ls -A'
107+
alias l='ls -CF'
108+
alias grep='grep --color=auto'
109+
alias fd='fdfind'
110+
111+
# Starship prompt
112+
eval "$(starship init zsh)"
113+
EOF
114+
115+
# Configuration Starship (thème sobre et informatif)
116+
RUN mkdir -p /home/$USERNAME/.config && cat <<'EOF' > /home/$USERNAME/.config/starship.toml
117+
# Prompt minimaliste style fish
118+
format = """
119+
$directory\
120+
$git_branch\
121+
$git_status\
122+
$character"""
123+
124+
[directory]
125+
style = "cyan bold"
126+
truncation_length = 3
127+
truncate_to_repo = true
128+
129+
[git_branch]
130+
symbol = " "
131+
style = "purple"
132+
133+
[git_status]
134+
style = "red bold"
135+
format = '([$all_status$ahead_behind]($style) )'
136+
137+
[character]
138+
success_symbol = "[❯](green)"
139+
error_symbol = "[❯](red)"
140+
EOF
141+
142+
RUN chown -R $USERNAME:$USERNAME /home/$USERNAME/.zshrc /home/$USERNAME/.config
143+
57144
USER $USERNAME
58145
WORKDIR /workspaces
59146

60-
CMD ["bash"]
147+
CMD ["zsh"]

.devcontainer/base/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"anthropic.claude-code"
2525
],
2626
"settings": {
27-
"terminal.integrated.defaultProfile.linux": "bash"
27+
"terminal.integrated.defaultProfile.linux": "zsh"
2828
}
2929
}
3030
},

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ Rebuild only occurs if changes are detected. All templates are built in parallel
125125
| Package | Description |
126126
| ----------- | ----------------------- |
127127
| Claude Code | Anthropic CLI |
128+
| zsh | Shell with fish-like UX |
129+
| starship | Modern prompt |
128130
| gh | GitHub CLI |
129131
| git | Version control |
130132
| ripgrep | Fast search |
@@ -134,6 +136,13 @@ Rebuild only occurs if changes are detected. All templates are built in parallel
134136
| procps | Process tools (ps, top) |
135137
| lsof | File/network debugging |
136138

139+
Zsh is configured with:
140+
- **Autosuggestions**: history-based suggestions
141+
- **Syntax highlighting**: command colorization
142+
- **Starship prompt**: modern prompt with git status
143+
- **Advanced completion**: Tab navigation, case-insensitive
144+
- **Fish-like keybindings**: Ctrl+Space to accept, arrows for history search
145+
137146
### Base with BMAD
138147

139148
All base packages plus:

0 commit comments

Comments
 (0)