Skip to content

Commit

Permalink
[Lazy] Switch to zsh / oh-my-zsh
Browse files Browse the repository at this point in the history
  • Loading branch information
nervo committed Oct 14, 2024
1 parent b18250f commit c0105fb
Show file tree
Hide file tree
Showing 24 changed files with 459 additions and 585 deletions.
2 changes: 1 addition & 1 deletion lazy.ansible/.manala/Makefile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ sh:
else \
$(call manala_docker_command, \
$(if $(PORT),--publish $(PORT)), \
) bash --login ; \
) zsh --login ; \
fi
.PHONY: sh

Expand Down
14 changes: 9 additions & 5 deletions lazy.ansible/.manala/docker/Dockerfile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ RUN \
apt-get --quiet update \
&& apt-get --quiet --yes --purge --autoremove upgrade \
&& apt-get --quiet --yes --no-install-recommends --verbose-versions install \
bash-completion \
bzip2 \
ca-certificates \
curl \
Expand All @@ -43,9 +42,10 @@ RUN \
socat \
sudo \
vim \
zsh \
# User
&& addgroup --gid ${MANALA_GROUP_ID} lazy \
&& adduser --home /home/lazy --shell /bin/bash --uid ${MANALA_USER_ID} --gecos lazy --ingroup lazy --disabled-password lazy \
&& adduser --home /home/lazy --shell /bin/zsh --uid ${MANALA_USER_ID} --gecos lazy --ingroup lazy --disabled-password lazy \
&& install --verbose --mode 0755 --group lazy --owner lazy --directory /run/user/${MANALA_USER_ID} \
&& echo "lazy ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/lazy \
# Gosu
Expand All @@ -70,8 +70,12 @@ RUN \
&& chmod +x /usr/local/bin/yq \
# Bash completion
&& install --verbose --mode 0755 --directory /etc/bash_completion.d \
# Oh My Bash
&& git clone https://github.com/ohmybash/oh-my-bash.git /usr/local/share/oh-my-bash \
# Oh My Zsh
&& git clone https://github.com/ohmyzsh/ohmyzsh.git /usr/local/share/oh-my-zsh \
# See: https://github.com/ohmyzsh/ohmyzsh/issues/11995
&& git clone https://github.com/zsh-users/zsh-autosuggestions /usr/local/share/oh-my-zsh/custom/plugins/zsh-autosuggestions \
&& git clone https://github.com/zsh-users/zsh-syntax-highlighting.git /usr/local/share/oh-my-zsh/custom/plugins/zsh-syntax-highlighting \
&& echo "ZDOTDIR=/etc/zsh" > /etc/zsh/zshenv \
# Clean
&& rm -rf /var/lib/apt/lists/*

Expand Down Expand Up @@ -207,4 +211,4 @@ complete -C /usr/local/bin/terraform tf\n\
# Run
COPY docker/entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
CMD ["bash"]
CMD ["zsh"]
148 changes: 0 additions & 148 deletions lazy.ansible/.manala/etc/profile.d/oh-my-bash.sh.tmpl

This file was deleted.

8 changes: 0 additions & 8 deletions lazy.ansible/.manala/etc/profile.d/zz-direnv.sh.tmpl

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ printf " \033[36m· {{ $dependency }}\033[0m\n"
{{- if $terraform.version }}
printf " \033[36m‣ terraform \033[35m{{ $terraform.version }}\033[0m\n"
{{- end }}
printf "\n"

{{- $help := .Vars.project.help }}
{{- if $help }}
printf "\n"
cat << EOF
{{ $help }}
EOF
Expand Down
109 changes: 109 additions & 0 deletions lazy.ansible/.manala/etc/zsh/.zshrc.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# 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=/usr/local/share/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=(
git
direnv
zsh-autosuggestions
zsh-syntax-highlighting
)

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"
2 changes: 1 addition & 1 deletion lazy.ansible/test/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ user:
exists: true
groups:
- lazy
shell: /bin/bash
shell: /bin/zsh

file:
# Base
Expand Down
8 changes: 0 additions & 8 deletions lazy.kubernetes/.manala.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,10 @@ system:
# @schema {"enum": [null, "1.30.0"]}
# @option {"label": "Stern version"}
version: ~
kube-prompt:
# @schema {"enum": [null, "1.0.11"]}
# @option {"label": "Kube-prompt version"}
version: ~
popeye:
# @schema {"enum": [null, "0.21.5"]}
# @option {"label": "Popeye version"}
version: ~
knsk:
# @schema {"enum": [null, "1.0"]}
# @option {"label": "Kubernetes namespace killer version"}
version: ~
vault:
# @schema {"enum": [null, "1.17.5", "1.16.3", "1.15.6", "1.14.10"]}
# @option {"label": "Vault version"}
Expand Down
9 changes: 0 additions & 9 deletions lazy.kubernetes/.manala.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,10 @@ system:
stern:
version: {{ .Vars.system.stern.version | toYaml }}
{{- end }}
{{- $kubePrompt := index .Vars.system "kube-prompt" -}}
{{- if $kubePrompt.version }}
kube-prompt:
version: {{ $kubePrompt.version | toYaml }}
{{- end }}
{{- if .Vars.system.popeye.version }}
popeye:
version: {{ .Vars.system.popeye.version | toYaml }}
{{- end }}
{{- if .Vars.system.knsk.version }}
knsk:
version: {{ .Vars.system.knsk.version | toYaml }}
{{- end }}
{{- if .Vars.system.vault.version }}
vault:
version: {{ .Vars.system.vault.version | toYaml }}
Expand Down
2 changes: 1 addition & 1 deletion lazy.kubernetes/.manala/Makefile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ sh:
else \
$(call manala_docker_command, \
$(if $(PORT),--publish $(PORT)), \
) bash --login ; \
) zsh --login ; \
fi
.PHONY: sh

Expand Down
Loading

0 comments on commit c0105fb

Please sign in to comment.