Files
install-zsh/install.sh
T
2026-04-06 11:35:45 +07:00

55 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
# Debian/Ubuntu bootstrap for zsh, tmux, Neovim, and related dotfiles.
# Run from this directory (zsh/) so the cp paths below resolve.
# APT: refresh index, upgrade, and install CLI dependencies
sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install -y zsh tmux wget curl git vim nmon neofetch nload htop
# Oh My Zsh: skip if already present; env -u ZSH avoids installer errors when ZSH is exported from a login shell
_omz_dir="${ZSH:-$HOME/.oh-my-zsh}"
if [ ! -d "$_omz_dir" ]; then
CHSH=no RUNZSH=no env -u ZSH sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
else
echo "Oh My Zsh already installed at $_omz_dir, skipping."
fi
ZSH_CUSTOM="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"
# Zsh plugins + enable them in ~/.zshrc
git clone https://github.com/zsh-users/zsh-autosuggestions.git "$ZSH_CUSTOM/plugins/zsh-autosuggestions"
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting"
sed -i 's|(git)|(git zsh-autosuggestions zsh-syntax-highlighting)|' ~/.zshrc
# Powerlevel10k theme
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "$ZSH_CUSTOM/themes/powerlevel10k"
# Tmux Plugin Manager
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# Neovim: latest Linux x86_64 AppImage -> /usr/local/bin/nvim
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.appimage
chmod +x nvim-linux-x86_64.appimage
sudo mv nvim-linux-x86_64.appimage /usr/local/bin/nvim
# Tmuxinator Zsh completion
sudo mkdir -p /usr/local/share/zsh/site-functions
sudo wget https://raw.githubusercontent.com/tmuxinator/tmuxinator/master/completion/tmuxinator.zsh -O /usr/local/share/zsh/site-functions/_tmuxinator
# Tmuxinator alias in ~/.zshrc (skip if already present)
if ! grep -qxF 'alias mux=tmuxinator' ~/.zshrc 2>/dev/null; then
printf '\n# tmuxinator\nalias mux=tmuxinator\n' >> ~/.zshrc
fi
# Dotfiles from this repo (paths relative to cwd)
mkdir -p ~/.config/nvim/ ~/.tmuxinator/
cp init.lua ~/.config/nvim/init.lua
cp p10k.zsh ~/.p10k.zsh
cp tmux.conf ~/.tmux.conf
cp tmuxinator.yml ~/.tmuxinator/project.yml
# Login shell -> zsh for the next session. Uses sudo chsh (not interactive `chsh`),
# so it typically only prompts if sudo is not already cached from the steps above.
_chsh_user="${SUDO_USER:-$USER}"
echo "Changing shell to zsh for $_chsh_user"
sudo chsh -s "$(command -v zsh)" "$_chsh_user"