Skip to content

Instantly share code, notes, and snippets.

@jonatasbueno
Last active August 9, 2025 04:07
Show Gist options
  • Select an option

  • Save jonatasbueno/802c0354369aabf743a46e24bd588b25 to your computer and use it in GitHub Desktop.

Select an option

Save jonatasbueno/802c0354369aabf743a46e24bd588b25 to your computer and use it in GitHub Desktop.
Estilizando terminal no Linux Ubuntu com Kettiy

🛠️ Guia Completo: Kitty + Zsh + Powerlevel10k no Ubuntu 24.04.2 LTS

Este guia mostra como configurar um terminal leve, moderno e bonito com:

  • Kitty como emulador de terminal padrão
  • Zsh
  • fzf como buscador interativo e dinâmico
  • bat como visualizador de arquivos enquanto pesquisa com fzf
  • Powerlevel10k
  • Autosuggestions e Syntax Highlighting
  • Fonte Nerd Font com ícones e ligaduras ativadas
  • Tema escuro compatível com Powerlevel10k

💡 Objetivo: Um terminal rápido, funcional e estiloso com baixo overhead e aparência profissional


🚀 Etapa 1: Instalar o Kitty

sudo apt update
sudo apt install kitty

Alternativamente, para a versão mais recente:

curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh

Isso instalará o Kitty em ~/.local/kitty.app. Para tornar o comando kitty disponível:

echo 'export PATH="$HOME/.local/kitty.app/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

🧾 Etapa 2: Criar atalho no sistema (opcional)

cp ~/.local/kitty.app/share/applications/kitty.desktop ~/.local/share/applications/
sed -i "s|Exec=kitty|Exec=$HOME/.local/kitty.app/bin/kitty|" ~/.local/share/applications/kitty.desktop

🎯 Etapa 3: Instale o Zsh e torne-o padrão

sudo apt install zsh
chsh -s $(which zsh)

Reinicie o terminal e execute zsh na primeira inicialização.


🎨 Etapa 4: Instale a fonte MesloLGS Nerd Font

mkdir -p ~/.local/share/fonts
cd ~/.local/share/fonts
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf
fc-cache -fv

⚙️ Etapa 5: Instale Powerlevel10k

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.powerlevel10k
echo 'source ~/.powerlevel10k/powerlevel10k.zsh-theme' >> ~/.zshrc

Ao abrir o Kitty com Zsh pela primeira vez, será iniciado o p10k configure. Veja abaixo como configurá-lo.


💻 Etapa 6: Instale o fzf

O fzf é um utilitário de linha de comando que fornece uma interface de busca fuzzy. Você pode instalá-lo de duas maneiras: usando o gerenciador de pacotes apt ou clonando o repositório do GitHub.

Método 1: Usando o apt

Se você estiver em um sistema baseado em Debian ou Ubuntu, pode instalar o fzf diretamente usando o apt. Execute os seguintes comandos:

sudo apt update
sudo apt install fzf

Método 2: Usando o git

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install

💡 Etapa 7: Instale autosuggestions, syntax highlighting e auto completar visual

git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
echo 'source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh' >> ~/.zshrc

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.zsh/zsh-syntax-highlighting
echo 'source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh' >> ~/.zshrc

Insera manualmente o carregamento do do fzf no ~/.zsh

source ~/.zsh/plugins/fzf-tab/fzf-tab.plugin.zshrc

📚 Etapa 8: Insira os atalhos para buscar arquivos, histórico de comandos digitados e branchs do git no ~/.zshrc

gh() {
  eval "$(history | fzf --height 40% --border --reverse --prompt='Hist> ')"
}

gf() {
  local file
  file=$(fzf --height 40% --border --reverse --prompt='Arquivo> ')
  [[ -n "$file" ]] && ${EDITOR:-vim} "$file"
}

gfp() {
  local file
  file=$(fzf --preview 'expand -t 2 {} | batcat --style=numbers --color=always --paging=never' --height 40% --border --reverse --prompt='Preview> ')
  [[ -n "$file" ]] && ${EDITOR:-vim} "$file"
}

gb() {
  local branch
  branch=$(git branch | sed 's/* //' | fzf --height 40% --border --reverse --prompt='Branch> ')
  [[ -n "$branch" ]] && git checkout "$branch"
}

🎨 Etapa 9: Configurar Kitty (tema, fonte, aparência)

Edite ~/.config/kitty/kitty.conf:

font_family      MesloLGS Nerd Font
font_size        12.0
background_opacity 0.90
background       #1e1e2e
enable_ligatures true

# Tema recomendado
include ~/.config/kitty/themes/Dracula.conf

Para usar um tema escuro como Dracula:

mkdir -p ~/.config/kitty/themes
curl -o ~/.config/kitty/themes/Dracula.conf https://raw.githubusercontent.com/dexpota/kitty-themes/master/themes/Dracula.conf

Outras opções de tema: https://github.com/dexpota/kitty-themes

💡 O Kitty não suporta blur real como o WezTerm, mas possui renderização acelerada por GPU que o torna extremamente rápido.


✅ Etapa 10: Tornar o Kitty o terminal padrão

sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/bin/kitty 60
sudo update-alternatives --config x-terminal-emulator

Escolha o número correspondente ao kitty.


🧪 Etapa 11: Testes finais

  • Kitty deve abrir com aparência semi-transparente
  • Powerlevel10k deve aparecer ao iniciar Zsh
  • Autocompletar e sugestões devem funcionar
  • Syntax highlighting ativo
  • Atalho gh, gf, gfp, gb devem abrir respectivamente uma busca dinâmica em histórico, arquivos, arquivos com pré-visualização e branchs

Se necessário, recarregue com:

source ~/.zshrc

🎉 Pronto!

Você configurou com sucesso um terminal moderno, leve e visualmente bonito com Kitty + Zsh + Powerlevel10k.

Confira o visual abaixo

image

Screenshot from 2025-06-28 22-01-35

image

Screenshot from 2025-06-28 22-01-10

image

image

Caso queria uma colinha

Esse é meu zshrc, fique a vontade pra usar de referência ou copiar

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

# ─── Configurações gerais ──────────────────────────────────────
export NEO_DISABLE_MITIGATIONS=1
export EDITOR="code"  # ou code, vim, micro, etc

# ─── Powerlevel10k Theme ────────────────────────────────────────
source ~/.powerlevel10k/powerlevel10k.zsh-theme
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

# ─── Autocomplete interno do Zsh ────────────────────────────────
autoload -Uz compinit && compinit
zstyle ':completion:*' menu select

# ─── Histórico de comandos ─────────────────────────────────────
HISTFILE=~/.zsh_history              # Onde o histórico é salvo
HISTSIZE=10000                       # Quantos comandos manter em memória
SAVEHIST=10000                       # Quantos comandos salvar no arquivo

setopt HIST_IGNORE_DUPS             # Ignora comandos duplicados seguidos
setopt HIST_IGNORE_ALL_DUPS         # Remove duplicados antigos ao repetir
setopt HIST_FIND_NO_DUPS            # Evita mostrar duplicados com ↑
setopt HIST_REDUCE_BLANKS           # Remove espaços extras
setopt INC_APPEND_HISTORY           # Salva no histórico à medida que usa
setopt SHARE_HISTORY                # Compartilha histórico entre sessões

# Opcional: atualiza sugestões ao digitar (para zsh-autosuggestions)
zstyle ':zsh-autosuggestions:' history-ignore-space true

# ─── Plugins ───────────────────────────────────────────────────

# Sugestões baseadas no histórico (esmaecidas)
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh

# Realce de sintaxe no terminal
source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

# Autocomplete visual ao pressionar Tab (fzf-tab)
source ~/.zsh/plugins/fzf-tab/fzf-tab.plugin.zsh

# ─── FZF Atalhos úteis ──────────────────────────────────────────

# Buscar e executar comando do histórico
gh() {
  eval "$(history | fzf --height 40% --border --reverse --prompt='Hist> ')"
}

# Abrir arquivos com fuzzy
gf() {
  local file
  file=$(fzf --height 40% --border --reverse --prompt='Arquivo> ')
  [[ -n "$file" ]] && ${EDITOR:-vim} "$file"
}

# Abrir arquivos com preview
gfp() {
  local file
  file=$(fzf --preview 'expand -t 2 {} | batcat --style=numbers --color=always --paging=never' --height 40% --border --reverse --prompt='Preview> ')
  [[ -n "$file" ]] && ${EDITOR:-vim} "$file"
}

# Trocar de branch do Git com fuzzy
gb() {
  local branch
  branch=$(git branch | sed 's/* //' | fzf --height 40% --border --reverse --prompt='Branch> ')
  [[ -n "$branch" ]] && git checkout "$branch"
}

# ─── Node Version Manager ───────────────────────────────────────

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

# ─── SDKMAN ─────────────────────────────────────────────────────

#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
@andpeicunha
Copy link

Muito massa meu amigo, já usei o Powerlevel uns anos, mas confesso que hoje o Spaceship está no meu coração, mas não conhecia o Kitty, boa!

@jonatasbueno
Copy link
Author

Muito massa meu amigo, já usei o Powerlevel uns anos, mas confesso que hoje o Spaceship está no meu coração, mas não conhecia o Kitty, boa!

Concordo contigo @andpeicunha o Spaceship é muito bonito e convidativo não da pra negar rs e usei muito ele também, só migrei pro powerlevel10k por que as vezes eu sou fanático por velocidade e powerlevel10k é mais rápido, coisa de dev né kkk

@aacastro91
Copy link

Boa...

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