mirror of
https://github.com/marcogll/omarchy_setup.git
synced 2026-01-13 21:35:16 +00:00
feat: add dev tools, AI aliases, and improve zshrc documentation
This commit introduces several new features and improvements: - **Adds Development Tools to `apps.sh`:** The `apps.sh` module now installs essential development tools, including `python`, `pip`, `nodejs`, `npm`, `uv`, and `nvm`. - **Implements `.zshrc.local` for Private Variables:** - A `.zshrc.local.example` file has been added to serve as a template for users to securely store their private environment variables, such as API keys. - The main `.zshrc` file now sources `.zshrc.local` if it exists. - **Adds AI Aliases to `.zshrc`:** A new section has been added to `.zshrc` with example aliases for interacting with command-line AI tools. - **Improves `.zshrc` Documentation:** The `.zshrc` file has been thoroughly documented with comments in Spanish, explaining the purpose of each section. The title has also been updated and professionalized. - **Fixes a Regression:** This commit restores the `ytm`, `ytv`, `ytls`, and SSH agent functions in `.zshrc` that were accidentally removed in a previous step.
This commit is contained in:
@@ -13,6 +13,18 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Opciones comunes para curl con timeout moderado y reintentos breves.
|
||||
ZSH_CURL_TIMEOUT_OPTS=(--fail --location --silent --show-error --connect-timeout 10 --max-time 60 --retry 2 --retry-delay 2)
|
||||
|
||||
zsh_download_with_timeout() {
|
||||
local url="$1"
|
||||
local dest="$2"
|
||||
if curl "${ZSH_CURL_TIMEOUT_OPTS[@]}" -o "$dest" "$url"; then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
install_zsh() {
|
||||
log_step "Configuración Completa de Zsh"
|
||||
|
||||
@@ -55,10 +67,20 @@ install_zsh() {
|
||||
else
|
||||
log_warning "No se pudo instalar Oh My Posh mediante pacman ni AUR."
|
||||
log_info "Descargando instalador oficial de Oh My Posh..."
|
||||
if curl -fsSL https://ohmyposh.dev/install.sh | sudo bash -s -- -d /usr/local/bin; then
|
||||
log_success "Oh My Posh instalado usando el script oficial."
|
||||
local omp_installer
|
||||
omp_installer="$(mktemp)"
|
||||
if [[ -n "$omp_installer" ]] && zsh_download_with_timeout "https://ohmyposh.dev/install.sh" "$omp_installer"; then
|
||||
if sudo bash "$omp_installer" -d /usr/local/bin; then
|
||||
log_success "Oh My Posh instalado usando el script oficial."
|
||||
else
|
||||
log_error "Falló la instalación de Oh My Posh usando el script oficial."
|
||||
rm -f "$omp_installer"
|
||||
return 1
|
||||
fi
|
||||
rm -f "$omp_installer"
|
||||
else
|
||||
log_error "Fallo la instalación de Oh My Posh usando el script oficial."
|
||||
rm -f "${omp_installer:-}"
|
||||
log_error "No se pudo descargar el instalador oficial de Oh My Posh."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
@@ -71,12 +93,25 @@ install_zsh() {
|
||||
local target_ohmyzsh_dir="${target_home}/.oh-my-zsh"
|
||||
if [[ ! -d "$target_ohmyzsh_dir" ]]; then
|
||||
log_info "Instalando Oh My Zsh..."
|
||||
# Usar RUNZSH=no para evitar que inicie un nuevo shell y CHSH=no para no cambiar el shell aún
|
||||
if ! env HOME="$target_home" RUNZSH=no CHSH=no \
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended --keep-zshrc; then
|
||||
log_error "Falló la instalación de Oh My Zsh."
|
||||
local omz_installer
|
||||
omz_installer="$(mktemp)"
|
||||
if [[ -z "$omz_installer" ]]; then
|
||||
log_error "No se pudo crear un archivo temporal para el instalador de Oh My Zsh."
|
||||
return 1
|
||||
fi
|
||||
if zsh_download_with_timeout "https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh" "$omz_installer"; then
|
||||
# Usar RUNZSH=no para evitar que inicie un nuevo shell y CHSH=no para no cambiar el shell aún
|
||||
if ! env HOME="$target_home" RUNZSH=no CHSH=no sh "$omz_installer" --unattended --keep-zshrc; then
|
||||
rm -f "$omz_installer"
|
||||
log_error "Falló la instalación de Oh My Zsh."
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
rm -f "$omz_installer"
|
||||
log_error "No se pudo descargar el instalador de Oh My Zsh."
|
||||
return 1
|
||||
fi
|
||||
rm -f "$omz_installer"
|
||||
else
|
||||
log_info "Oh My Zsh ya está instalado."
|
||||
fi
|
||||
@@ -115,7 +150,7 @@ install_zsh() {
|
||||
local tmp_download="${target_home}/.zshrc.omarchy-tmp"
|
||||
local source_file=""
|
||||
|
||||
if curl -fsSL "${REPO_BASE}/.zshrc" -o "$tmp_download" && [[ -s "$tmp_download" ]]; then
|
||||
if zsh_download_with_timeout "${REPO_BASE}/.zshrc" "$tmp_download" && [[ -s "$tmp_download" ]]; then
|
||||
source_file="$tmp_download"
|
||||
log_success "Configuración .zshrc descargada desde el repositorio remoto."
|
||||
else
|
||||
@@ -156,7 +191,7 @@ install_zsh() {
|
||||
local posh_theme_local="${SCRIPT_DIR_ROOT}/themes/catppuccin_frappe.omp.json"
|
||||
mkdir -p "$posh_themes_dir"
|
||||
|
||||
if curl -fsSL "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/catppuccin_frappe.omp.json" -o "$theme_file"; then
|
||||
if zsh_download_with_timeout "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/catppuccin_frappe.omp.json" "$theme_file"; then
|
||||
chmod 644 "$theme_file" 2>/dev/null || true
|
||||
log_success "Tema Catppuccin Frappe descargado en $theme_file"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user