* New translations README.md (Dutch) * New translations README.md (Polish) * New translations README.md (Portuguese) * New translations README.md (Russian) * New translations README.md (Turkish) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Traditional) * New translations README.md (Vietnamese) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Turkish) * New translations README.md (Russian) * New translations README.md (Portuguese) * New translations README.md (Polish) * New translations README.md (Dutch) * New translations README.md (Japanese) * New translations README.md (Italian) * New translations README.md (German) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Traditional) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Vietnamese) * New translations README.md (Polish) * New translations README.md (Dutch) * New translations README.md (Korean) * New translations README.md (Japanese) * New translations README.md (Italian) * New translations README.md (German) * New translations README.md (Arabic) * New translations README.md (Spanish) * New translations README.md (French) * New translations README.md (Portuguese) * New translations README.md (Arabic) * New translations README.md (Spanish) * New translations README.md (French) * New translations README.md (Korean) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Russian) * New translations README.md (Vietnamese) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Simplified) * New translations README.md (Turkish) * New translations README.md (French) * New translations README.md (German) * New translations README.md (Japanese) * New translations README.md (Italian) * New translations README.md (Arabic) * New translations README.md (Spanish) * New translations README.md (French) * New translations README.md (Dutch) * New translations README.md (Korean) * New translations README.md (Russian) * New translations README.md (Portuguese) * New translations README.md (Polish) * New translations README.md (Portuguese) * New translations README.md (Polish) * New translations README.md (Dutch) * New translations README.md (Korean) * New translations README.md (Japanese) * New translations README.md (Russian) * New translations README.md (Arabic) * New translations README.md (Turkish) * New translations README.md (Spanish) * New translations README.md (German) * New translations README.md (Italian) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Vietnamese) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Vietnamese) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Simplified) * New translations README.md (Turkish) * New translations README.md (Chinese Simplified) * New translations README.md (Polish) * New translations README.md (Dutch) * New translations README.md (Japanese) * New translations README.md (Italian) * New translations README.md (German) * New translations README.md (Portuguese) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Vietnamese) * New translations README.md (Chinese Traditional) * New translations README.md (Russian) * New translations README.md (Chinese Simplified) * New translations README.md (Turkish) * New translations README.md (Arabic) * New translations README.md (Spanish) * New translations README.md (French) * New translations README.md (Korean) * New translations README.md (German) * New translations README.md (Polish) * New translations README.md (Dutch) * New translations README.md (Japanese) * New translations README.md (Italian) * New translations README.md (German) * New translations README.md (Portuguese) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Vietnamese) * New translations README.md (Chinese Traditional) * New translations README.md (Russian) * New translations README.md (Chinese Simplified) * New translations README.md (Turkish) * New translations README.md (Arabic) * New translations README.md (Spanish) * New translations README.md (French) * New translations README.md (Korean) * New translations README.md (French) * New translations README.md (Spanish) * New translations README.md (Arabic) * New translations README.md (German) * New translations README.md (Italian) * New translations README.md (Japanese) * New translations README.md (Korean) * New translations README.md (Dutch) * New translations README.md (Polish) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Vietnamese) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Simplified) * New translations README.md (Turkish) * New translations README.md (Russian) * New translations README.md (Portuguese) * New translations README.md (Polish) * New translations README.md (Dutch) * New translations README.md (Japanese) * New translations README.md (Italian) * New translations README.md (German) * New translations README.md (Portuguese) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Vietnamese) * New translations README.md (Chinese Traditional) * New translations README.md (Russian) * New translations README.md (Chinese Simplified) * New translations README.md (Turkish) * New translations README.md (Arabic) * New translations README.md (Spanish) * New translations README.md (French) * New translations README.md (Korean) * New translations README.md (Spanish) * New translations README.md (French) * New translations README.md (Arabic) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Vietnamese) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Simplified) * New translations README.md (Turkish) * New translations README.md (Russian) * New translations README.md (Portuguese) * New translations README.md (Polish) * New translations README.md (Dutch) * New translations README.md (Korean) * New translations README.md (Italian) * New translations README.md (German) * New translations README.md (French) * New translations README.md (Japanese) * New translations README.md (Spanish) * New translations README.md (French) * New translations README.md (Japanese) * New translations README.md (Portuguese) * New translations README.md (Portuguese) * New translations README.md (Polish) * New translations README.md (Polish) * New translations README.md (Dutch) * New translations README.md (Dutch) * New translations README.md (Korean) * New translations README.md (Korean) * New translations README.md (Japanese) * New translations README.md (Russian) * New translations README.md (Italian) * New translations README.md (Italian) * New translations README.md (German) * New translations README.md (German) * New translations README.md (Arabic) * New translations README.md (Spanish) * New translations README.md (Spanish) * New translations README.md (Russian) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Arabic) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Vietnamese) * New translations README.md (Vietnamese) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Simplified) * New translations README.md (Turkish) * New translations README.md (Turkish) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Japanese) * New translations README.md (Korean) * New translations README.md (Dutch) * New translations README.md (Polish) * New translations README.md (Portuguese) * New translations README.md (Russian) * New translations README.md (Turkish) * New translations README.md (Italian) * New translations README.md (Chinese Simplified) * New translations README.md (Chinese Traditional) * New translations README.md (Vietnamese) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Sorani (Kurdish)) * New translations README.md (German) * New translations README.md (French) * New translations README.md (Spanish) * New translations README.md (Arabic) * New translations README.md (German) * New translations README.md (Arabic) * New translations README.md (Spanish) * New translations README.md (French) * New translations README.md (Portuguese) * New translations README.md (Polish) * New translations README.md (Dutch) * New translations README.md (Russian) * New translations README.md (Vietnamese) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Turkish) * New translations README.md (Chinese Traditional) * New translations README.md (Chinese Simplified) * New translations README.md (Korean) * New translations README.md (Italian) * New translations README.md (Japanese) * New translations README.md (Polish) * New translations README.md (Dutch) * New translations README.md (Japanese) * New translations README.md (Italian) * New translations README.md (German) * New translations README.md (Portuguese) * New translations README.md (Sorani (Kurdish)) * New translations README.md (Portuguese, Brazilian) * New translations README.md (Vietnamese) * New translations README.md (Chinese Traditional) * New translations README.md (Russian) * New translations README.md (Chinese Simplified) * New translations README.md (Turkish) * New translations README.md (Arabic) * New translations README.md (Spanish) * New translations README.md (French) * New translations README.md (Korean)
4.6 KiB
Configuración Avanzada
Mientras que Starship es un prompt versátil, a veces necesitas más que editar starhip.toml
para que haga ciertas cosas. Esta página detalla algunas de las técnicas de configuración más avanzadas en Starship.
::: aviso
Las configuraciones de esta sección están sujetos a cambios en futuras versiones de Starship.
:::
Comandos pre-prompt y pre-ejecucución personalizados en Bash
Bash no posee un framework oficial de preexec/precmd como la mayoría de los demás intérpretes de comandos. Debido a esto, es difícil proporcionar "hooks" totalmente personalizables en Bash
. Sin embargo, Starship te da la posibilidad de insertar de forma limitada tus propias funciones en el proceso de renderizado del prompt:
- Para ejecutar una función personalizada previa al renderizado del prompt, define una nueva función y asigna su nombre a
starship_precmd_user_func
. Por ejemplo, para renderizar un cohete antes del prompt, se puede realizar así:
function blastoff(){
echo "🚀"
}
starship_precmd_user_func="blastoff"
- Para ejecutar una función personalizada antes de que un comando sea ejecutado, es posible usar el mecanismo trap
DEBUG
. No obstante, ¡debes atrapar la señal DEBUG antes de inicializar Starship! Starship puede preservar el valor de la trampa DEBUG, pero si la trampa es reemplazada después de que Starship inicie, alguna funcionalidad fallará.
function blastoff(){
echo "🚀"
}
trap blastoff DEBUG # Trampa DEBUG *antes* de la ejecución de Starship
eval $(starship init bash)
Cambiar el Título de la Ventana
Algunos intérpretes de comandos van a cambiar automáticamente el título de la ventana por ti (p. ej., para mostrar tu directorio actual). Fish incluso lo hace por defecto. Starship no hace esto, pero es bastante sencillo añadir esta funcionalidad a Bash
o zsh
.
Primero, define una función para el cambio de título de la ventana (idéntico en Bash y zsh):
function set_win_title(){
echo -ne "\033]0; TU_TÍTULO_DE_VENTANA_AQUÍ \007"
}
Puedes usar variables para personalizar este título ($USER
, $HOSTNAME
y $PWD
son opciones populares).
En Bash
, establece que esta función sea la función precmd de Starship:
starship_precmd_user_func="set_win_title"
En zsh
, añade esto al array precmd_functions
:
precmd_functions+=(set_win_title)
Si te gusta el resultado, añade estas líneas a tu archivo de configuración del intérprete de comandos (~/.bashrc
o ~/.zsrhc
) para hacerlo permanente.
Por ejemplo, si quieres mostrar tu directorio actual en el título de la pestaña de la terminal, añade el siguiente fragmento a tu ~/.bashrc
o ~/.zshrc
:
function set_win_title(){
echo -ne "\033]0; $(basename "$PWD") \007"
}
starship_precmd_user_func="set_win_title"
Cadenas de Estilo
Las cadenas de estilo son una lista de palabras, separadas por espacios en blanco. Las palabras no son sensibles a mayúsculas (es decir, bold
y BoLd
se consideran la misma cadena). Cada palabra puede ser una de las siguientes:
bold
underline
dimmed
bg:<color>
fg:<color>
<color>
none
donde <color>
es un especificador de color (discutido a continuación). fg:<color>
y <color>
hacen actualmente lo mismo, aunque esto puede cambiar en el futuro. El orden de las palabras en la cadena no importa.
El token none
anula todos los demás tokens en una cadena si no es parte de un especificador bg:
, de modo que por ejemplo fg:red none fg:blue
creará una cadena sin ningún estilo. bg:none
establece el fondo al color por defecto, así que fg:red bg:none
es equivalente a red
o fg:red
y bg:green fg:red bg:none
también es equivalente a fg:red
o red
. Puede convertirse en un error usar none
junto con otros tokens en el futuro.
Un especificador de color puede ser uno de los siguientes:
- Uno de los colores estándar del terminal:
black
,red
,green
,blue
,yellow
,purple
,cyan
,white
. Opcionalmente puedes agregar el prefijobright-
para obtener la versión brillante (por ejemplo,bright-white
). - Un
#
seguido de un número hexadecimal de seis dígitos. Esto especifica un código hexadecimal de color RGB. - Un número entre 0-255. Esto especifica un Código de color ANSI de 8-bits.
Si se especifican varios colores para el primer plano/fondo, el último en la cadena tendrá prioridad.