Skip to content

Instantly share code, notes, and snippets.

@SamEureka
Last active July 30, 2023 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SamEureka/a01012a1ccfe21f3b7d7fb23cccec153 to your computer and use it in GitHub Desktop.
Save SamEureka/a01012a1ccfe21f3b7d7fb23cccec153 to your computer and use it in GitHub Desktop.
ZSH and P10k for all

ZSH and P10k for all!

The idea behind this gist is to make this settings the default for all users

INstalling zsh and P10k to the correct places

  • sudo apt install -y zsh (debian based distro) sudo apk add zsh (alpine)
  • sudo git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /usr/share/zsh/powerlevel10k
  • sudo git clone https://github.com/zsh-users/zsh-autosuggestions /usr/share/zsh/zsh-autosuggestions
  • sudo git clone https://github.com/zsh-users/zsh-syntax-highlighting.git /usr/share/zsh/zsh-syntax-highlighting

Skeletons!

  • Create the template zshrc and p10k file, then link them to the skel
sudo -s -- <<EOL
echo "Creating zshrc"
cat << EZSH >> /usr/share/zsh/zshrc
source /usr/share/zsh/powerlevel10k/powerlevel10k.zsh-theme
source /usr/share/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
source /usr/share/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

alias ls="ls --color=auto"
alias lsa="ls -al --color=auto"

EZSH
echo "------- END OF LINE -------"
EOL

Note: The p10k.zsh file is freaking huge. The best way is to have p10k gen that fucker. Copy the zshrc above to your .zshrc and restart your term. The p10k config will run and you can pick your defaults. Then run the following. sudo cp ~/.p10k.zsh /usr/share/zsh/p10k.zsh

  • make some links sudo ln /usr/share/zsh/zshrc /etc/skel/.zshrc sudo ln /usr/share/zsh/p10k.zsh /etc/skel/.p10k.zsh

Creating users

sudo adduser -D -s /usr/bin/zsh ($(which zsh) maybe)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment