Skip to content

Instantly share code, notes, and snippets.

@jalvarado-it
Last active August 27, 2025 00:41
Show Gist options
  • Select an option

  • Save jalvarado-it/0c06c39aaf66facdb2994a5627460094 to your computer and use it in GitHub Desktop.

Select an option

Save jalvarado-it/0c06c39aaf66facdb2994a5627460094 to your computer and use it in GitHub Desktop.
Instalar OhMyZsh y Wezterm

Instalación de OhMyZsh

📋 Resumen

Instalación completa de OhMyZsh

Instalación de Dependencias

# Actualizar el sistema
sudo apt update && sudo apt upgrade -y

# Instalar Zsh, Git, Curl y fuentes necesarias
sudo apt install zsh git curl wget fonts-powerline fzf -y

# Cambiar Zsh como shell por defecto
chsh -s $(which zsh)

Instalar OhMyZsh

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

Instalación de Powerlevel10k

# Clonar Powerlevel10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

Instalación de estensiones

# zsh-autosuggestions (sugerencias automáticas)
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

# zsh-syntax-highlighting (resaltado de sintaxis)
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

# zsh-completions (autocompletado mejorado)
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions

# fzf (búsqueda difusa)
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install

Configuración de archivo zshrc

# Hacer backup del archivo actual
cp ~/.zshrc ~/.zshrc.backup

# Editar el archivo .zshrc
nano ~/.zshrc

Reemplazar

# Tema Powerlevel10k 
ZSH_THEME="powerlevel10k/powerlevel10k"

# Plugins recomendados 
plugins=(
    git
    zsh-autosuggestions
    zsh-syntax-highlighting
    zsh-completions
    docker
    docker-compose
    kubectl
    sudo
    web-search
    copypath
    copyfile
    copybuffer
    dirhistory
    history
    jsontools
    node
    npm
    yarn
    pip
    python
    ubuntu
    vscode
    fzf
)

# Configuraciones adicionales 
CASE_SENSITIVE="false" 
HYPHEN_INSENSITIVE="true" 
DISABLE_AUTO_UPDATE="false" 
UPDATE_ZSH_DAYS=7 
DISABLE_LS_COLORS="false" 
DISABLE_AUTO_TITLE="false" 
ENABLE_CORRECTION="true" 
COMPLETION_WAITING_DOTS="true" 
DISABLE_UNTRACKED_FILES_DIRTY="true"

Agregar

## Aliases
## =======
alias ls='lsd'
alias ll='lsd -l'
alias la='lsd -la'
alias lla='lsd -la'
alias lt='lsd --tree'
alias l='lsd -l'
alias lh='lsd -lh'          # tamaños legibles
alias lr='lsd -lR'          # recursivo
alias lS='lsd -lS'          # ordenar por tamaño
alias ltr='lsd -ltr'        # ordenar por fecha (más reciente último)
alias lx='lsd -lX'          # ordenar por extensión
alias tree='lsd --tree'     # vista de árbol
alias ltree='lsd --tree -l' # árbol con detalles
alias cat='batcat'
alias bat='batcat'
alias pcat='batcat --style=plain --paging=never' # plain: sin números ni paginación
alias ccat='batcat --style=plain'  # sin números de línea ni decoraciones
alias bcat='batcat --paging=never' # sin paginación
alias bathelp='batcat --help'
alias batl='batcat --language'     # especificar lenguaje
alias ..='cd ..'
alias ...='cd ../..'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias h='history'
alias c='clear'
alias reload='source ~/.zshrc'

## Anaconda
## ========

PATH="$PATH:/home/$HOME/anaconda3/bin"
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/$HOME/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/$HOME/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/home/$HOME/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/home/$HOME/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<


## NVM
## ===
# >>> NVM initialize >>>
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
# <<< NVM initialize <<<


## OLLAMA
## ======
# >>> OLLAMA initialize >>>
export PATH="/home/$HOME/.local/bin:$PATH"
export OLLAMA_API_BASE=http://127.0.0.1:11434
export OLLAMA_MODELS=/ai/models/LLM
export OLLAMA_NUM_CTX=65536
# <<< OLLAMA initialize <<<

## LMStudio
## ========
# >>> LMStudio initialize >>>
export PATH="$PATH:/home/$HOME/.lmstudio/bin"
# <<< LMStudio initialize <<<

## fzf
## ===
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

# Configuración de autocompletado
autoload -U compinit && compinit

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# opencode
export PATH=/home/$HOME/.opencode/bin:$PATH

Instalar fuentes Nerd Fonts (recomendado)

# Crear directorio para fuentes
mkdir -p ~/.local/share/fonts

# Descargar fuente MesloLGS NF (recomendada por Powerlevel10k)
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

# Actualizar cache de fuentes
fc-cache -fv

Configurar PowerLevel10k

# Reiniciar la sesión de terminal o ejecutar:
source ~/.zshrc

# Configurar Powerlevel10k (se ejecutará automáticamente la primera vez)
p10k configure

Adicionales

# Instalar bat y lsd
sudo apt install bat lsd -y

Configuración de bat

# Crear directorio de configuración
mkdir -p ~/.config/bat

# Crear archivo de configuración
cat > ~/.config/bat/config << 'EOF'
# Tema por defecto (puedes cambiarlo)
--theme="Dracula"

# Mostrar números de línea
--style="numbers,changes,header"

# Usar paginador por defecto
--paging=auto

# Ancho de tab
--tabs=4
EOF

Configuración de lsd

# Crear archivo de configuración para lsd
mkdir -p ~/.config/lsd

cat > ~/.config/lsd/config.yaml << 'EOF'
# Configuración de lsd
classic: false
blocks:
  - permission
  - user
  - group
  - size
  - date
  - name
color:
  when: auto
date: relative
dereference: false
display: all
icons:
  when: auto
  theme: fancy
ignore-globs: []
indicators: false
layout: grid
recursion:
  enabled: false
  depth: 3
size: default
permission: rwx
sorting:
  column: name
  reverse: false
  dir-grouping: first
no-symlink: false
total-size: false
hyperlink: never
EOF

Wezterm

.config/wezterm/wezterm.lua

-- ~/.config/wezterm/wezterm.lua
-- Configuración completa de WezTerm optimizada

local wezterm = require 'wezterm'
local config = {}

-- Usar config builder si está disponible (WezTerm 20220807 en adelante)
if wezterm.config_builder then
  config = wezterm.config_builder()
end

-- ====== CONFIGURACIÓN DE FUENTES ======
config.font = wezterm.font_with_fallback {
  'JetBrains Mono Nerd Font',
  'MesloLGS NF',
  'FiraCode Nerd Font',
  'Cascadia Code',
  'Consolas',
}

config.font_size = 13.0
config.line_height = 1.2
config.freetype_load_flags = 'NO_HINTING'
config.freetype_load_target = 'Light'

-- ====== TEMA Y COLORES ======
-- config.color_scheme = 'Dracula (Official)'
-- config.color_scheme = 'Tokyo Night'
-- config.color_scheme = 'Catppuccin Mocha'
-- config.color_scheme = 'nord'
-- config.color_scheme = 'One Dark (Vivid)'
-- config.color_scheme = 'Gruvbox Dark (Gogh)'
-- config.color_scheme = 'Solarized Dark (Gogh)'
config.color_scheme = 'MaterialDark'

-- Colores personalizados adicionales
config.colors = {
  foreground = '#f8f8f2',
  background = '#282a36',
  cursor_bg = '#f8f8f2',
  cursor_fg = '#282a36',
  cursor_border = '#f8f8f2',
  selection_fg = '#f8f8f2',
  selection_bg = '#44475a',

  -- Colores de la barra de tabs
  tab_bar = {
    background = '#21222c',
    active_tab = {
      bg_color = '#6272a4',
      fg_color = '#f8f8f2',
      intensity = 'Normal',
      underline = 'None',
      italic = false,
      strikethrough = false,
    },
    inactive_tab = {
      bg_color = '#282a36',
      fg_color = '#6272a4',
    },
    inactive_tab_hover = {
      bg_color = '#44475a',
      fg_color = '#f8f8f2',
    },
    new_tab = {
      bg_color = '#21222c',
      fg_color = '#6272a4',
    },
    new_tab_hover = {
      bg_color = '#44475a',
      fg_color = '#f8f8f2',
    },
  },
}

-- ====== CONFIGURACIÓN DE VENTANA ======
config.window_background_opacity = 0.95
config.window_decorations = 'RESIZE'
config.window_close_confirmation = 'AlwaysPrompt'
config.window_padding = {
  left = 10,
  right = 10,
  top = 10,
  bottom = 10,
}

-- Fondo con imagen (opcional)
-- config.window_background_image = '/path/to/your/wallpaper.jpg'
-- config.window_background_image_hsb = {
--   brightness = 0.3,
--   hue = 1.0,
--   saturation = 1.0,
-- }

-- ====== CONFIGURACIÓN DE TABS ======
config.enable_tab_bar = true
config.hide_tab_bar_if_only_one_tab = false
config.use_fancy_tab_bar = true
config.tab_bar_at_bottom = false
config.tab_max_width = 25
config.show_tabs_in_tab_bar = true
config.show_new_tab_button_in_tab_bar = true

-- ====== CONFIGURACIÓN DE SCROLLBACK ======
config.scrollback_lines = 10000
config.enable_scroll_bar = true

-- ====== CONFIGURACIÓN DE CURSOR ======
config.default_cursor_style = 'BlinkingBlock'
config.cursor_blink_rate = 500
config.cursor_thickness = 2

-- ====== CONFIGURACIÓN DE AUDIO ======
config.audible_bell = 'Disabled'
config.visual_bell = {
  fade_in_function = 'EaseIn',
  fade_in_duration_ms = 150,
  fade_out_function = 'EaseOut',
  fade_out_duration_ms = 150,
}

-- ====== ATAJOS DE TECLADO ======
config.keys = {
  -- Copiar y pegar
  { key = 'c', mods = 'CTRL|SHIFT', action = wezterm.action.CopyTo 'Clipboard' },
  { key = 'v', mods = 'CTRL|SHIFT', action = wezterm.action.PasteFrom 'Clipboard' },

  -- Gestión de tabs
  { key = 't', mods = 'CTRL|SHIFT', action = wezterm.action.SpawnTab 'CurrentPaneDomain' },
  { key = 'w', mods = 'CTRL|SHIFT', action = wezterm.action.CloseCurrentTab { confirm = true } },

  -- Navegación entre tabs
  { key = 'Tab', mods = 'CTRL', action = wezterm.action.ActivateTabRelative(1) },
  { key = 'Tab', mods = 'CTRL|SHIFT', action = wezterm.action.ActivateTabRelative(-1) },

  -- Tabs numerados
  { key = '1', mods = 'CTRL', action = wezterm.action.ActivateTab(0) },
  { key = '2', mods = 'CTRL', action = wezterm.action.ActivateTab(1) },
  { key = '3', mods = 'CTRL', action = wezterm.action.ActivateTab(2) },
  { key = '4', mods = 'CTRL', action = wezterm.action.ActivateTab(3) },
  { key = '5', mods = 'CTRL', action = wezterm.action.ActivateTab(4) },

  -- División de paneles
  { key = 'd', mods = 'CTRL|SHIFT', action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' } },
  { key = 'r', mods = 'CTRL|SHIFT', action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' } },

  -- Navegación entre paneles
  { key = 'h', mods = 'CTRL|SHIFT', action = wezterm.action.ActivatePaneDirection 'Left' },
  { key = 'l', mods = 'CTRL|SHIFT', action = wezterm.action.ActivatePaneDirection 'Right' },
  { key = 'k', mods = 'CTRL|SHIFT', action = wezterm.action.ActivatePaneDirection 'Up' },
  { key = 'j', mods = 'CTRL|SHIFT', action = wezterm.action.ActivatePaneDirection 'Down' },

  -- Redimensionar paneles
  { key = 'LeftArrow', mods = 'CTRL|SHIFT|ALT', action = wezterm.action.AdjustPaneSize { 'Left', 5 } },
  { key = 'RightArrow', mods = 'CTRL|SHIFT|ALT', action = wezterm.action.AdjustPaneSize { 'Right', 5 } },
  { key = 'UpArrow', mods = 'CTRL|SHIFT|ALT', action = wezterm.action.AdjustPaneSize { 'Up', 5 } },
  { key = 'DownArrow', mods = 'CTRL|SHIFT|ALT', action = wezterm.action.AdjustPaneSize { 'Down', 5 } },

  -- Zoom de paneles
  { key = 'z', mods = 'CTRL|SHIFT', action = wezterm.action.TogglePaneZoomState },

  -- Cerrar panel
  { key = 'x', mods = 'CTRL|SHIFT', action = wezterm.action.CloseCurrentPane { confirm = true } },

  -- Búsqueda
  { key = 'f', mods = 'CTRL|SHIFT', action = wezterm.action.Search { CaseSensitiveString = '' } },

  -- Scroll
  { key = 'u', mods = 'CTRL|SHIFT', action = wezterm.action.ScrollByPage(-1) },
  { key = 'y', mods = 'CTRL|SHIFT', action = wezterm.action.ScrollByPage(1) },

  -- Limpiar terminal
  { key = 'k', mods = 'CTRL|ALT', action = wezterm.action.ClearScrollback 'ScrollbackAndViewport' },

  -- Recargar configuración
  { key = 'r', mods = 'CTRL|ALT', action = wezterm.action.ReloadConfiguration },

  -- Fullscreen
  { key = 'F11', action = wezterm.action.ToggleFullScreen },

  -- Comandos personalizados
  { key = 'n', mods = 'CTRL|SHIFT', action = wezterm.action.SpawnWindow },
}

-- ====== CONFIGURACIÓN DE MOUSE ======
config.mouse_bindings = {
  -- Clic derecho para pegar
  {
    event = { Down = { streak = 1, button = 'Right' } },
    mods = 'NONE',
    action = wezterm.action.PasteFrom 'Clipboard',
  },

  -- Ctrl + clic para abrir URLs
  {
    event = { Up = { streak = 1, button = 'Left' } },
    mods = 'CTRL',
    action = wezterm.action.OpenLinkAtMouseCursor,
  },
}

-- ====== CONFIGURACIÓN DE RENDIMIENTO ======
config.max_fps = 120
config.animation_fps = 60
config.front_end = 'WebGpu'  -- o 'OpenGL' si tienes problemas
config.webgpu_power_preference = 'HighPerformance'

-- ====== CONFIGURACIÓN DE SSH ======
config.ssh_domains = {
  -- Ejemplo de configuración SSH
  -- {
  --   name = 'servidor',
  --   remote_address = 'tu-servidor.com',
  --   username = 'tu-usuario',
  -- },
}

-- ====== CONFIGURACIÓN AVANZADA ======
-- Detección de URLs mejorada
config.hyperlink_rules = {
  -- URL estándar
  {
    regex = '\\b\\w+://[\\w.-]+:[0-9]+\\S*\\b',
    format = '$0',
  },
  -- URLs sin protocolo
  {
    regex = '\\b[\\w.-]+\\.[a-z]{2,4}\\b',
    format = 'https://$0',
  },
  -- Rutas de archivos
  {
    regex = '\\b/\\S+',
    format = 'file://$0',
  },
  -- IPs
  {
    regex = '\\b(?:[0-9]{1,3}\\.){3}[0-9]{1,3}:[0-9]+\\b',
    format = 'http://$0',
  },
}

-- ====== CONFIGURACIÓN DE WORKSPACE ======
-- Función para formatear el título de la tab
local function tab_title(tab_info)
  local title = tab_info.tab_title
  if title and #title > 0 then
    return title
  end
  return tab_info.active_pane.title
end

wezterm.on('format-tab-title', function(tab, tabs, panes, config, hover, max_width)
  local title = tab_title(tab)
  local color = 'blue'

  if tab.is_active then
    color = 'green'
  end

  return {
    { Background = { Color = color } },
    { Text = ' ' .. title .. ' ' },
  }
end)

-- ====== CONFIGURACIÓN DE STARTUP ======
-- Programa por defecto
-- config.default_prog = { 'zsh', '-l' }

-- Directorio de inicio
-- config.default_cwd = '/home/tu-usuario'

-- Variables de entorno
config.set_environment_variables = {
  TERM = 'wezterm',
  -- Agregar más variables si es necesario
}

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