Como deixar o terminal do linux bonito e produtivo

O zsh é um shell que é compatível com o bash, mas com algumas melhorias. Ele permite a instalação de temas e plugins, que deixam o terminal mais bonito e produtivo. Nesse tutorial, vou mostrar como instalar e configurar o zsh, o oh-my-zsh (framework para gerenciar o zsh) e o zinit (gerenciador de plugins do zsh).

Instalando o curl

O curl é um utilitário de linha de comando para transferir dados usando vários protocolos. Nós vamos precisar dele para baixar o oh-my-zsh e o zinit. Para instalar o curl, execute o comando abaixo:

sudo apt install curl

Instalando o zsh

Como dito anteriormente, o zsh é um shell que é compatível com o bash, mas com algumas melhorias. Para instalar o zsh, execute o comando abaixo:

sudo apt install zsh

Instalando o oh-my-zsh

O oh-my-zsh é um framework para gerenciar o zsh. Para instalar o oh-my-zsh, execute o comando abaixo:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Ou se preferir, execute o comando abaixo:

sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

A única diferença entre os dois comandos é que o primeiro usa o curl para baixar o script de instalação e o segundo usa o wget.

Configurando tema do oh-my-zsh

Para configurar o tema do oh-my-zsh, edite o arquivo ~/.zshrc e altere a variável ZSH_THEME. Para ver os temas disponíveis, acesse o link. Como no exemplo abaixo:

nano ~/.zshrc

Com o arquivo aberto, altere a variável ZSH_THEME para o tema desejado. No exemplo abaixo, o tema é o agnoster:

ZSH_THEME="arrow"

Se você tiver alguma fonte powerline instalada (eu prefiro a Consolas NF), altere a variável ZSH_THEME para o tema agnoster e adicione a variável POWERLEVEL9K_MODE com o valor nerdfont-complete:

ZSH_THEME="agnoster"
POWERLEVEL9K_MODE="nerdfont-complete"

Instalando o zinit

O zinit é um gerenciador de plugins do zsh. Para instalar o zinit, execute o comando abaixo:

bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)"

Para executar usando wget, execute o comando abaixo:

bash -c "$(wget timeout=10 --output-document=- https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)"

Instalando os plugins zsh-autosuggestions, zsh-syntax-highlighting e zsh-completions

Os plugins zsh-autosuggestions, zsh-syntax-highlighting e zsh-completions são plugins que deixam o terminal mais produtivo.

Para instalar os plugins, edite o arquivo ~/.zshrc e adicione os plugins no final

nano ~/.zshrc

Com o arquivo aberto, role até a última linha do arquivo e adicione os plugins abaixo:

### Plugins
zinit light zsh-users/zsh-autosuggestions
zinit light zsh-users/zsh-syntax-highlighting
zinit light zsh-users/zsh-completions

Finalizando

Para aplicar todas as alterações, feche o terminal e abra novamente, ou execute o comando abaixo:

source ~/.zshrc

Pronto, o terminal está bonito e produtivo.