Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lazy] Zsh - Change theme #458

Open
wants to merge 4 commits into
base: lazy/zsh
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
48 changes: 31 additions & 17 deletions lazy.ansible/.manala/docker/Dockerfile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ARG GOMPLATE_VERSION="4.1.0"
ARG DIRENV_VERSION="2.34.0"
ARG JQ_VERSION="1.7.1"
ARG YQ_VERSION="4.44.3"
ARG FZF_VERSION="0.55.0"

# The 'container' environment variable tells systemd that it's running inside a
# Docker container environment.
Expand All @@ -29,7 +30,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 +43,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 @@ -68,10 +69,16 @@ RUN \
&& curl -sSLf "https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_{{ include "arch_map" (dict "amd64" "amd64" "arm64" "arm64") }}" \
--output /usr/local/bin/yq \
&& 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.git /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 \
# Fzf
&& curl -sSLf "https://github.com/junegunn/fzf/releases/download/v${FZF_VERSION}/fzf-${FZF_VERSION}-linux_{{ include "arch_map" (dict "amd64" "amd64" "arm64" "arm64") }}.tar.gz" \
| bsdtar -xvf - -C /usr/local/bin \
&& chmod +x /usr/local/bin/fzf \
# Clean
&& rm -rf /var/lib/apt/lists/*

Expand Down Expand Up @@ -177,14 +184,27 @@ RUN \
RUN \
pipx install --pip-args="--no-cache-dir" \
molecule=={{ $molecule.version }} \
&& _MOLECULE_COMPLETE=bash_source molecule > /etc/bash_completion.d/molecule \
{{- if $molecule.dependencies }}
&& pipx inject --pip-args="--no-cache-dir" molecule \
{{- range $i, $dependency := $molecule.dependencies }}
{{- if $i }} \{{- end }}
{{ $dependency }}
{{ $dependency }} \
{{- end }}
{{- end }}
# Oh My Zsh plugin
# See: https://github.com/ohmyzsh/ohmyzsh/pull/12757
&& mkdir /usr/local/share/oh-my-zsh/custom/plugins/molecule \
&& printf "\
if (( ! $+commands[molecule] )); then\n\
return\n\
fi\n\
if [[ ! -f \"\$ZSH_CACHE_DIR/completions/_molecule\" ]]; then\n\
_MOLECULE_COMPLETE=zsh_source molecule | tee \"\$ZSH_CACHE_DIR/completions/_molecule\" >/dev/null\n\
source \"\$ZSH_CACHE_DIR/completions/_molecule\"\n\
else\n\
source \"\$ZSH_CACHE_DIR/completions/_molecule\"\n\
_MOLECULE_COMPLETE=zsh_source molecule | tee \"\$ZSH_CACHE_DIR/completions/_molecule\" >/dev/null &|\n\
fi\n\
" > /usr/local/share/oh-my-zsh/custom/plugins/molecule/molecule.plugin.zsh

{{ end -}}

Expand All @@ -194,17 +214,11 @@ RUN \
RUN \
curl -sSLf "https://releases.hashicorp.com/terraform/{{ $terraform.version }}/terraform_{{ $terraform.version }}_linux_{{ include "arch_map" (dict "amd64" "amd64" "arm64" "arm64") }}.zip" \
| bsdtar -xvf - -C /usr/local/bin \
&& chmod +x /usr/local/bin/terraform \
# Bash completion
&& echo "complete -C /usr/local/bin/terraform terraform" > /etc/bash_completion.d/terraform \
# Bash aliases
&& printf "alias tf='terraform'\n\
complete -C /usr/local/bin/terraform tf\n\
" > /etc/profile.d/terraform.sh
&& chmod +x /usr/local/bin/terraform

{{ end -}}

# 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.

125 changes: 125 additions & 0 deletions lazy.ansible/.manala/etc/zsh/.zshrc.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# 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="strug"

# 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
fzf
ansible
{{- if .Vars.system.docker }}
docker
{{- end }}
{{- if .Vars.system.molecule }}
molecule
{{- end }}
{{- if .Vars.system.terraform }}
terraform
{{- end }}
)

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"

## Prompt configuration

PROMPT="%{$fg[green]%}╭─%n@%m %{$reset_color%}%{$fg[yellow]%}in %1~ %{$reset_color%}${git_branch}
%{$fg[green]%}╰\$ %{$reset_color%}"
Loading
Loading