alejototaro.dev

Ghostty terminal: setup completo

Guía paso a paso para configurar Ghostty con Nerd Fonts, tema Palenight, Oh My Zsh, Starship y tmux.

| 4 min
ghosttyterminalzshtmuxstarship

Mi setup de terminal actual usa Ghostty como emulador, Oh My Zsh como shell framework, Starship como prompt y tmux como multiplexor. Acá documento todo el proceso de configuración desde cero.

Paso 1: Instalar una Nerd Font

Ghostty necesita una fuente con iconos para que los prompts y plugins se vean correctamente. Yo uso FiraCode Nerd Font.

brew install --cask font-fira-code-nerd-font
Verificar instalación

Después de instalar, abrí la app Font Book en macOS y buscá “FiraCode Nerd Font” para confirmar que se instaló correctamente.

Paso 2: Configurar Ghostty

La configuración de Ghostty se guarda en ~/.config/ghostty/config. Creá el directorio y el archivo si no existen:

mkdir -p ~/.config/ghostty
cat > ~/.config/ghostty/config << 'EOF'
font-family = FiraCode Nerd Font
font-size = 14
font-feature = ss02
font-feature = ss03
font-feature = ss05
font-feature = ss07

window-padding-x = 12
window-padding-y = 8
macos-titlebar-style = tabs

cursor-style = bar
cursor-style-blink = true

clipboard-read = allow
clipboard-write = allow
clipboard-paste-protection = false

shell-integration = zsh
shell-integration-features = cursor,sudo,title,ssh-env,ssh-terminfo
confirm-close-surface = false

keybind = super+shift+enter=new_split:right
keybind = super+shift+minus=new_split:down
keybind = super+shift+left=goto_split:left
keybind = super+shift+right=goto_split:right
EOF

Paso 3: Tema Palenight custom

Ghostty soporta temas custom. Creá el archivo del tema:

mkdir -p ~/.config/ghostty/themes
cat > ~/.config/ghostty/themes/palenight << 'EOF'
background = #292D3E
foreground = #A6ACCD
cursor-color = #FFCB6B
selection-background = #3C435E
selection-foreground = #EEFFFF

palette = 0=#292D3E
palette = 1=#F07178
palette = 2=#C3E88D
palette = 3=#FFCB6B
palette = 4=#82AAFF
palette = 5=#C792EA
palette = 6=#89DDFF
palette = 7=#A6ACCD
palette = 8=#676E95
palette = 9=#F07178
palette = 10=#C3E88D
palette = 11=#FFCB6B
palette = 12=#82AAFF
palette = 13=#C792EA
palette = 14=#89DDFF
palette = 15=#EEFFFF
EOF

Después agregá esta línea al config principal:

theme = palenight

Paso 4: Oh My Zsh + plugins

Instalar Oh My Zsh:

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

Instalar los plugins que uso:

# zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions \
  ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

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

# z (viene incluido en Oh My Zsh, solo hay que activarlo)

Activarlos en ~/.zshrc:

plugins=(
  git
  z
  zsh-autosuggestions
  zsh-syntax-highlighting
)
Orden de plugins

zsh-syntax-highlighting siempre debe ir último en la lista de plugins. Si lo ponés antes, puede causar problemas con el highlighting de otros plugins.

Paso 5: Starship prompt

Instalar Starship:

brew install starship

Agregar al final de ~/.zshrc:

eval "$(starship init zsh)"

Usar el preset tokyo-night como base y customizar:

mkdir -p ~/.config
starship preset tokyo-night -o ~/.config/starship.toml
Customización

Podés editar ~/.config/starship.toml para ajustar qué módulos se muestran. Yo desactivo el módulo package y nodejs porque agregan ruido al prompt.

Paso 6: tmux + plugins

Instalar tmux:

brew install tmux

Instalar TPM (Tmux Plugin Manager):

git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

Crear el archivo de configuración:

cat > ~/.tmux.conf << 'EOF'
# Cambiar prefix a Ctrl+a
unbind C-b
set -g prefix C-a
bind C-a send-prefix

# Empezar ventanas y paneles en 1
set -g base-index 1
setw -g pane-base-index 1

# Mouse
set -g mouse on

# True color + soporte Ghostty
set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",xterm-256color:RGB,xterm-ghostty:RGB"

# Extended keys para Ghostty
set -s extended-keys on
set -s extended-keys-format csi-u
set -as terminal-features 'xterm-ghostty:extkeys'

# Vi mode
setw -g mode-keys vi
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "pbcopy"

# Split con teclas más intuitivas
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"

# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'

# tmux-continuum: auto-save cada 15 min
set -g @continuum-restore 'on'

# Inicializar TPM (siempre al final)
run '~/.tmux/plugins/tpm/tpm'
EOF

Después de guardar, abrí tmux y presioná prefix + I (Ctrl+a, luego I) para instalar los plugins.

tmux-resurrect

tmux-resurrect guarda y restaura sesiones de tmux incluyendo ventanas, paneles y sus directorios. Combinado con tmux-continuum, las sesiones se guardan automáticamente cada 15 minutos y se restauran al abrir tmux.