Skip to content

Instantly share code, notes, and snippets.

@danilogco
Last active June 22, 2025 01:32
Show Gist options
  • Select an option

  • Save danilogco/add38f31bad753ab09a5b4b5fdc8f30d to your computer and use it in GitHub Desktop.

Select an option

Save danilogco/add38f31bad753ab09a5b4b5fdc8f30d to your computer and use it in GitHub Desktop.

Revisions

  1. Danilo Carolino revised this gist Jun 22, 2025. 1 changed file with 15 additions and 3 deletions.
    18 changes: 15 additions & 3 deletions zsh_install.sh
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,6 @@ if [ "$PM" = "dnf" ]; then
    sudo dnf update -y
    else
    sudo apt update -y
    sudo apt upgrade -y
    fi

    echo "📦 Instalando Zsh e dependências..."
    @@ -39,13 +38,16 @@ echo "🎨 Instalando Powerlevel10k..."
    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git \
    "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"

    echo "✨ Instalando plugins: autosuggestions e syntax-highlighting..."
    echo "✨ Instalando plugins: autosuggestions, syntax-highlighting e completions..."
    git clone https://github.com/zsh-users/zsh-autosuggestions \
    "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions"

    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \
    "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting"

    git clone https://github.com/zsh-users/zsh-completions \
    "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-completions"

    echo "🔤 Instalando fonte MesloLGS NF..."
    mkdir -p ~/.local/share/fonts
    cd ~/.local/share/fonts
    @@ -59,16 +61,20 @@ fc-cache -fv > /dev/null

    echo "📝 Atualizando ~/.zshrc..."

    # Define o tema powerlevel10k
    sed -i 's/^ZSH_THEME=.*/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc

    sed -i 's/plugins=(git)/plugins=(git sudo common-aliases zsh-autosuggestions zsh-syntax-highlighting)/' ~/.zshrc
    # Plugins incluindo zsh-completions
    sed -i 's/plugins=(git)/plugins=(git sudo common-aliases zsh-autosuggestions zsh-syntax-highlighting zsh-completions)/' ~/.zshrc

    # Garante que oh-my-zsh seja carregado
    grep -q "source \$ZSH/oh-my-zsh.sh" ~/.zshrc || echo -e '\nsource $ZSH/oh-my-zsh.sh' >> ~/.zshrc

    echo "📂 Criando ~/.zsh_aliases e ~/.zsh_envs se não existirem..."
    touch ~/.zsh_aliases
    touch ~/.zsh_envs

    # Garante que os arquivos sejam carregados
    grep -q 'source ~/.zsh_envs' ~/.zshrc || echo '[[ -f ~/.zsh_envs ]] && source ~/.zsh_envs' >> ~/.zshrc
    grep -q 'source ~/.zsh_aliases' ~/.zshrc || echo '[[ -f ~/.zsh_aliases ]] && source ~/.zsh_aliases' >> ~/.zshrc

    @@ -82,6 +88,12 @@ alias cleanup='sudo apt autoremove && sudo apt autoclean && flatpak uninstall --
    alias please='sudo $(fc -ln -1)'
    alias ip='ip -c a'
    alias ports='sudo lsof -i -P -n | grep LISTEN'
    # Aliases úteis de configuração Zsh
    alias zshconfig="nano ~/.zshrc"
    alias zshaliases="nano ~/.zsh_aliases"
    alias ohmyzsh="nano ~/.oh-my-zsh"
    alias zsh_update='omz update && git -C ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k pull'
    EOF

    echo "🧠 Alterando shell padrão para Zsh..."
  2. Danilo Carolino revised this gist Jun 22, 2025. 1 changed file with 27 additions and 11 deletions.
    38 changes: 27 additions & 11 deletions zsh_install.sh
    Original file line number Diff line number Diff line change
    @@ -2,11 +2,32 @@

    set -e

    # Detecta gerenciador de pacotes
    if command -v dnf &>/dev/null; then
    PM="dnf"
    elif command -v apt &>/dev/null; then
    PM="apt"
    else
    echo "Gerenciador de pacotes não suportado. Use dnf ou apt."
    exit 1
    fi

    echo "🛠️ Usando gerenciador de pacotes: $PM"

    echo "🌀 Atualizando pacotes..."
    sudo dnf update -y
    if [ "$PM" = "dnf" ]; then
    sudo dnf update -y
    else
    sudo apt update -y
    sudo apt upgrade -y
    fi

    echo "📦 Instalando Zsh e dependências..."
    sudo dnf install -y --allowerasing zsh git curl wget util-linux-user fontconfig
    if [ "$PM" = "dnf" ]; then
    sudo dnf install -y --allowerasing zsh git curl wget util-linux-user fontconfig
    else
    sudo apt install -y zsh git curl wget util-linux fontconfig
    fi

    echo "✅ Zsh instalado: $(zsh --version)"

    @@ -16,14 +37,14 @@ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/too

    echo "🎨 Instalando Powerlevel10k..."
    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git \
    ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
    "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"

    echo "✨ Instalando plugins: autosuggestions e syntax-highlighting..."
    git clone https://github.com/zsh-users/zsh-autosuggestions \
    ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
    "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions"

    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \
    ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
    "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting"

    echo "🔤 Instalando fonte MesloLGS NF..."
    mkdir -p ~/.local/share/fonts
    @@ -38,21 +59,16 @@ fc-cache -fv > /dev/null

    echo "📝 Atualizando ~/.zshrc..."

    # Define o tema
    sed -i 's/^ZSH_THEME=.*/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc

    # Plugins customizados
    sed -i 's/plugins=(git)/plugins=(git sudo common-aliases zsh-autosuggestions zsh-syntax-highlighting)/' ~/.zshrc

    # Garante que o oh-my-zsh será carregado
    grep -q "source \$ZSH/oh-my-zsh.sh" ~/.zshrc || echo -e '\nsource $ZSH/oh-my-zsh.sh' >> ~/.zshrc

    # Arquivos adicionais
    echo "📂 Criando ~/.zsh_aliases e ~/.zsh_envs se não existirem..."
    touch ~/.zsh_aliases
    touch ~/.zsh_envs

    # Garante que os sources estão no .zshrc (sem duplicar)
    grep -q 'source ~/.zsh_envs' ~/.zshrc || echo '[[ -f ~/.zsh_envs ]] && source ~/.zsh_envs' >> ~/.zshrc
    grep -q 'source ~/.zsh_aliases' ~/.zshrc || echo '[[ -f ~/.zsh_aliases ]] && source ~/.zsh_aliases' >> ~/.zshrc

    @@ -69,7 +85,7 @@ alias ports='sudo lsof -i -P -n | grep LISTEN'
    EOF

    echo "🧠 Alterando shell padrão para Zsh..."
    chsh -s $(which zsh)
    chsh -s "$(which zsh)"

    echo "✅ Tudo pronto!"
    echo "🔁 Execute 'zsh' ou reconecte para usar o novo shell com Powerlevel10k!"
  3. Danilo Carolino created this gist Jun 22, 2025.
    76 changes: 76 additions & 0 deletions zsh_install.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,76 @@
    #!/bin/bash

    set -e

    echo "🌀 Atualizando pacotes..."
    sudo dnf update -y

    echo "📦 Instalando Zsh e dependências..."
    sudo dnf install -y --allowerasing zsh git curl wget util-linux-user fontconfig

    echo "✅ Zsh instalado: $(zsh --version)"

    echo "📁 Instalando Oh My Zsh..."
    export RUNZSH=no
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

    echo "🎨 Instalando Powerlevel10k..."
    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git \
    ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

    echo "✨ Instalando plugins: autosuggestions e syntax-highlighting..."
    git clone https://github.com/zsh-users/zsh-autosuggestions \
    ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \
    ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

    echo "🔤 Instalando fonte MesloLGS NF..."
    mkdir -p ~/.local/share/fonts
    cd ~/.local/share/fonts

    wget -q https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf
    wget -q https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf
    wget -q https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf
    wget -q https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf

    fc-cache -fv > /dev/null

    echo "📝 Atualizando ~/.zshrc..."

    # Define o tema
    sed -i 's/^ZSH_THEME=.*/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc

    # Plugins customizados
    sed -i 's/plugins=(git)/plugins=(git sudo common-aliases zsh-autosuggestions zsh-syntax-highlighting)/' ~/.zshrc

    # Garante que o oh-my-zsh será carregado
    grep -q "source \$ZSH/oh-my-zsh.sh" ~/.zshrc || echo -e '\nsource $ZSH/oh-my-zsh.sh' >> ~/.zshrc

    # Arquivos adicionais
    echo "📂 Criando ~/.zsh_aliases e ~/.zsh_envs se não existirem..."
    touch ~/.zsh_aliases
    touch ~/.zsh_envs

    # Garante que os sources estão no .zshrc (sem duplicar)
    grep -q 'source ~/.zsh_envs' ~/.zshrc || echo '[[ -f ~/.zsh_envs ]] && source ~/.zsh_envs' >> ~/.zshrc
    grep -q 'source ~/.zsh_aliases' ~/.zshrc || echo '[[ -f ~/.zsh_aliases ]] && source ~/.zsh_aliases' >> ~/.zshrc

    echo "➕ Adicionando aliases em ~/.zsh_aliases..."
    cat << 'EOF' >> ~/.zsh_aliases
    # Meus aliases personalizados
    alias ll='ls -la --color=auto'
    alias upd='sudo apt update && sudo apt full-upgrade -y && flatpak upgrade -y'
    alias cleanup='sudo apt autoremove && sudo apt autoclean && flatpak uninstall --unused'
    alias please='sudo $(fc -ln -1)'
    alias ip='ip -c a'
    alias ports='sudo lsof -i -P -n | grep LISTEN'
    EOF

    echo "🧠 Alterando shell padrão para Zsh..."
    chsh -s $(which zsh)

    echo "✅ Tudo pronto!"
    echo "🔁 Execute 'zsh' ou reconecte para usar o novo shell com Powerlevel10k!"
    echo "🎨 Configure a fonte 'MesloLGS NF' no terminal (se gráfico) para exibir ícones corretamente."