Skip to content

Commit

Permalink
zsh and p10k
Browse files Browse the repository at this point in the history
  • Loading branch information
sysadmin4j committed Apr 24, 2024
1 parent 555e1e1 commit 7a8a105
Show file tree
Hide file tree
Showing 6 changed files with 1,768 additions and 20 deletions.
1,710 changes: 1,710 additions & 0 deletions .p10k.zsh

Large diffs are not rendered by default.

23 changes: 12 additions & 11 deletions .zshrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
echo "Sweet Home: " $HOME
# History
export HISTFILE=${HOME}/.local/state/zsh/.zsh_history
setopt share_history

# adding user bin folder to the path
path+=(${HOME}/.local/bin)
export PATH
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

# Aliases
alias jump="ssh jump"
#alias vi="nvim"
#alias vim="nvim"
alias nvim="ide nvim"
source ${HOME}/.local/share/zsh/powerlevel10k/powerlevel10k.zsh-theme

# History
setopt share_history
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
15 changes: 15 additions & 0 deletions .zshrc.macos
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
echo "Sweet Home: " $HOME

# adding user bin folder to the path
path+=(${HOME}/.local/bin)
export PATH

# Aliases
alias jump="ssh jump"
#alias vi="nvim"
#alias vim="nvim"
alias nvim="ide nvim"

# History
export HISTFILE=${HOME}/.local/state/zsh/.zsh_history
setopt share_history
26 changes: 17 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ ARG GROUPNAME=ide
ARG UID=1000
ARG GID=1000

# creating the non-root user
RUN groupadd -o -g ${GID} ${GROUPNAME} && adduser -u ${UID} -g ${GROUPNAME} ${USERNAME}

# required for man pages
RUN sed -i 's/^.*\(tsflags=nodocs\).*/# the option tsflags=nodocs has been commented by the docker build\r\n#\1/g' /etc/dnf/dnf.conf

# installing feroda packages
RUN dnf -y install man man-pages man-db git curl make gcc strace python3-pip icu ripgrep fd-find unzip npm nodejs wget glibc-langpack-en firefox dnf-plugins-core && dnf clean all
RUN dnf -y install man man-pages man-db zsh git curl make gcc strace python3-pip icu ripgrep fd-find unzip npm nodejs wget glibc-langpack-en firefox dnf-plugins-core && dnf clean all

# reinstalling curl to get the man pages
RUN dnf -y reinstall curl && dnf clean all

# creating the non-root user
RUN groupadd -o -g ${GID} ${GROUPNAME} && adduser -u ${UID} -g ${GROUPNAME} -s /bin/zsh ${USERNAME}

# installing lazygit
RUN dnf copr enable atim/lazygit -y
RUN dnf install -y lazygit && dnf clean all
Expand Down Expand Up @@ -49,10 +49,20 @@ RUN curl -f -l -O ${MARKDOWN_PREVIEW_URL} && npm install
COPY --chown=${USERNAME} requirements.txt ${HOME}/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

#RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
# Copy the zsh config files
COPY --chown=${USERNAME} .zshrc ${HOME}/.zshrc
COPY --chown=${USERNAME} .p10k.zsh ${HOME}/.p10k.zsh

# Create the folder to store .zsh_history
RUN mkdir -p ${HOME}/.local/state/zsh

# Installing powerlevel10k
ENV POWERLEVEL10K_VERSION=1.20.0
ENV POWERLEVEL10K_URL="https://github.com/romkatv/powerlevel10k/archive/refs/tags/v${POWERLEVEL10K_VERSION}.tar.gz"
#RUN curl -f -l
RUN curl -f -L ${POWERLEVEL10K_URL} -o powerlevel10k.tar.gz && \
mkdir -p ${HOME}/.local/share/zsh/powerlevel10k && \
tar -zxf powerlevel10k.tar.gz --strip-components=1 -C ${HOME}/.local/share/zsh/powerlevel10k && \
rm powerlevel10k.tar.gz

# Copy nvim config files
COPY --chown=${USERNAME} .config/nvim ${HOME}/.config/nvim
Expand All @@ -62,6 +72,4 @@ RUN nvim --headless +"15sleep" +"qa!"
RUN nvim --headless +"Lazy check" +"Lazy update" +"15sleep" +"qa!"
RUN nvim --headless +"Mason" +"MasonInstall lua-language-server stylua" +"qa!"

# TODO:
# - zsh? powerlevel10k
# - firefox or chrome config for markdown-preview
CMD ["/bin/zsh"]
13 changes: 13 additions & 0 deletions scripts/apply-zsh-config.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# exit the script when an error occurs
set -e

# create the folder used to store the history file
mkdir -p ${HOME}/.local/state/zsh

# extract the path of the current script
SCRIPTS_PATH=$(dirname "$0")

# copy files with confirmation to override
cp -i ${SCRIPTS_PATH}/../.zshrc.macos ${HOME}/.zshrc
1 change: 1 addition & 0 deletions scripts/docker-run-ide.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ docker run -it --rm \
-u $(id -u ${USER}):$(id -g ${USER}) \
-v ${HOME}/.ssh:/home/${USER}/.ssh \
-v ${HOME}/.gitconfig:/home/${USER}/.gitconfig \
-v ${HOME}/.local/state/zsh:/home/${USER}/.local/state/zsh \
-v ${HOME}/.local/state/nvim/sessions:/home/${USER}/.local/state/nvim/sessions \
-v ${HOME}/.local/state/nvim/shada:/home/${USER}/.local/state/nvim/shada \
-v ${HOME}/Repos:/home/${USER}/Repos \
Expand Down

0 comments on commit 7a8a105

Please sign in to comment.