add zsh and plugins
This commit is contained in:
+76
-6
@@ -53,7 +53,6 @@ if ! dpkg -s dbeaver-ce >/dev/null 2>&1; then
|
|||||||
sudo tee /etc/apt/sources.list.d/dbeaver.list
|
sudo tee /etc/apt/sources.list.d/dbeaver.list
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# apt packages
|
# apt packages
|
||||||
# ============================================================
|
# ============================================================
|
||||||
@@ -107,14 +106,84 @@ APT_PACKAGES=(
|
|||||||
mssql-tools18
|
mssql-tools18
|
||||||
unixodbc-dev
|
unixodbc-dev
|
||||||
dbeaver-ce
|
dbeaver-ce
|
||||||
|
zsh
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
echo "=== apt packages ==="
|
echo "=== apt packages ==="
|
||||||
sudo apt-get update -y
|
sudo apt-get update -y
|
||||||
sudo apt-get upgrade -y
|
sudo apt-get upgrade -y
|
||||||
ACCEPT_EULA=Y sudo apt-get install -y "${APT_PACKAGES[@]}"
|
ACCEPT_EULA=Y sudo apt-get install -y "${APT_PACKAGES[@]}"
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# Set zsh as default shell
|
||||||
|
# ============================================================
|
||||||
|
echo "=== zsh default shell ==="
|
||||||
|
if [[ "$(getent passwd "$USER" | cut -d: -f7)" != *"zsh"* ]]; then
|
||||||
|
chsh -s "$(which zsh)"
|
||||||
|
echo "*** zsh set as default shell — log out/in required for full effect. ***"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# oh-my-zsh
|
||||||
|
# ============================================================
|
||||||
|
echo "=== oh-my-zsh ==="
|
||||||
|
ZSH_CUSTOM="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"
|
||||||
|
if [[ ! -d "$HOME/.oh-my-zsh" ]]; then
|
||||||
|
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# zsh plugins (syntax-highlighting + autosuggestions)
|
||||||
|
# ============================================================
|
||||||
|
echo "=== zsh plugins ==="
|
||||||
|
|
||||||
|
ZSH_HIGHLIGHT_REPO="https://github.com/zsh-users/zsh-syntax-highlighting.git"
|
||||||
|
ZSH_AUTOSUGGEST_REPO="https://github.com/zsh-users/zsh-autosuggestions.git"
|
||||||
|
|
||||||
|
if [[ ! -d "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting" ]]; then
|
||||||
|
git clone --depth 1 "$ZSH_HIGHLIGHT_REPO" "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -d "$ZSH_CUSTOM/plugins/zsh-autosuggestions" ]]; then
|
||||||
|
git clone --depth 1 "$ZSH_AUTOSUGGEST_REPO" "$ZSH_CUSTOM/plugins/zsh-autosuggestions"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# .zshrc
|
||||||
|
# ============================================================
|
||||||
|
echo "=== .zshrc ==="
|
||||||
|
ZSHRC="$HOME/.zshrc"
|
||||||
|
cat > "$ZSHRC" << 'ZSHRC_EOF'
|
||||||
|
export ZSH="$HOME/.oh-my-zsh"
|
||||||
|
ZSH_THEME="robbyrussell"
|
||||||
|
plugins=(
|
||||||
|
git
|
||||||
|
zsh-syntax-highlighting
|
||||||
|
zsh-autosuggestions
|
||||||
|
)
|
||||||
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
|
export PATH="$HOME/.cargo/bin:$PATH"
|
||||||
|
export PATH="$PATH:/usr/local/go/bin"
|
||||||
|
export GOPATH="$HOME/go"
|
||||||
|
export PATH="$PATH:$GOPATH/bin"
|
||||||
|
export PATH="$PATH:/opt/mssql-tools18/bin"
|
||||||
|
ZSHRC_EOF
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# tmux — default shell to zsh
|
||||||
|
# ============================================================
|
||||||
|
echo "=== tmux default shell ==="
|
||||||
|
TMUX_CONF="$HOME/.tmux.conf"
|
||||||
|
TOUCH_TMUX=0
|
||||||
|
if [[ ! -f "$TMUX_CONF" ]]; then
|
||||||
|
touch "$TMUX_CONF"
|
||||||
|
TOUCH_TMUX=1
|
||||||
|
fi
|
||||||
|
if ! grep -qF 'set-option -g default-shell' "$TMUX_CONF"; then
|
||||||
|
printf 'set-option -g default-shell %s\n' "$(which zsh)" >> "$TMUX_CONF"
|
||||||
|
fi
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# Add user to libvirt groups
|
# Add user to libvirt groups
|
||||||
# ============================================================
|
# ============================================================
|
||||||
@@ -240,11 +309,10 @@ if ! command -v task >/dev/null 2>&1; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# Ensure cargo is in PATH
|
# Ensure cargo is in PATH (.bashrc kept for non-interactive bash)
|
||||||
# ============================================================
|
# ============================================================
|
||||||
if ! grep -q 'export PATH="$HOME/.cargo/bin:$PATH"' "$HOME/.bashrc"; then
|
if ! grep -q 'export PATH="$HOME/.cargo/bin:$PATH"' "$HOME/.bashrc"; then
|
||||||
printf '\nexport PATH="$HOME/.cargo/bin:$PATH"\n' >> "$HOME/.bashrc"
|
printf '\nexport PATH="$HOME/.cargo/bin:$PATH"\n' >> "$HOME/.bashrc"
|
||||||
source "$HOME/.bashrc"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
@@ -258,6 +326,8 @@ sudo systemctl enable --now libvirtd.service
|
|||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
echo "=== Done ==="
|
echo "=== Done ==="
|
||||||
echo "Log out and back in for libvirt group to take effect."
|
echo "zsh is the default shell — log out and back in."
|
||||||
echo "Rust and Cargo are at ~/.cargo/bin — added to .bashrc."
|
echo "tmux is configured to use zsh as default-shell."
|
||||||
|
echo "oh-my-zsh with syntax-highlighting + autosuggestions installed."
|
||||||
|
echo "Rust and Cargo are at ~/.cargo/bin — added to .zshrc and .bashrc."
|
||||||
echo "If mssql-server was installed, run: sudo /opt/mssql/bin/mssql-conf setup"
|
echo "If mssql-server was installed, run: sudo /opt/mssql/bin/mssql-conf setup"
|
||||||
|
|||||||
Reference in New Issue
Block a user