Personalizar
Esta página fue traducida por PageTurner AI (beta). No está respaldada oficialmente por el proyecto. ¿Encontraste un error? Reportar problema →
La inicialización estándar establece el tema predeterminado integrado de Oh My Posh.
Para configurar un nuevo tema o personalización, debes modificar la opción --config en la línea oh-my-posh init <shell>
de tu script profile o .<shell>rc (consulta prompt).
Estos son los tres tipos de valores que puede aceptar la bandera --config:
-
Una ruta local a un archivo de configuración
--config 'C:/Users/Posh/myconfig.omp.json' -
Una referencia a un tema, sin la extensión del archivo
--config 'jandedobbeleer' -
Una URL que apunte a una configuración remota
--config 'https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/jandedobbeleer.omp.json'
Usar un nombre de tema (como jandedobbeleer) o una URL remota requiere una conexión a internet activa
y descargará la configuración al iniciar el shell. Existe un sistema de caché, pero para un mejor rendimiento,
se recomienda usar un archivo de configuración local.
Establecer la configuración
El ejemplo a continuación utiliza una ruta local al tema jandedobbeleer, ajusta el valor de --config
para que refleje tu archivo de configuración, ya sea local o remoto.
- bash
- cmd
- elvish
- fish
- nu
- powershell
- xonsh
- zsh
Use the full path to the config file, not the relative path or ~ as a shorthand for $HOME.
Adjust the Oh My Posh init line in ~/.bashrc (could be ~/.profile or ~/.bash_profile depending
on your environment) by adding the --config flag with the location of your configuration.
eval "$(oh-my-posh init bash --config ~/jandedobbeleer.omp.json)"
Once altered, reload your profile for the changes to take effect.
exec bash
Adjust the Oh My Posh init line in oh-my-posh.lua by adding the --config flag with the location
of your configuration.
load(io.popen('oh-my-posh init cmd --config C:/Users/Posh/jandedobbeleer.omp.json'):read("*a"))()
Use the full path to the config file, not the relative path. You can make use of forward slashes to avoid having to use double backslashes.
Once altered, restart cmd for the changes to take effect.
Adjust the Oh My Posh init line in ~/.elvish/rc.elv by adding the --config flag with the location
of your configuration.
eval (oh-my-posh init elvish --config ~/jandedobbeleer.omp.json)
Once added, reload your profile for the changes to take effect.
exec elvish
It is recommended to use the latest version of Fish. Versions below 4.1.0 have issues and do not support [transient prompt].
Adjust the Oh My Posh init line in ~/.config/fish/config.fish by adding the --config flag with
the location of your configuration.
oh-my-posh init fish --config ~/jandedobbeleer.omp.json | source
Once altered, reload your config for the changes to take effect.
. ~/.config/fish/config.fish
Oh My Posh requires Nushell v0.104.0 or higher.
Adjust the Oh My Posh init line in the Nushell config file ($nu.config-path) by adding the --config flag
with the location of your configuration.
oh-my-posh init nu --config ~/jandedobbeleer.omp.json
Adjust the Oh My Posh init line in your $PROFILE by adding the --config flag with the location
of your configuration.
oh-my-posh init pwsh --config ~/jandedobbeleer.omp.json | Invoke-Expression
Once altered, reload your profile for the changes to take effect.
. $PROFILE
When the above command gives an error, make sure to create the profile first and add the oh-my-posh init above.
New-Item -Path $PROFILE -Type File -Force
In this scenario, it can also be that PowerShell blocks running local scripts. To solve that, set PowerShell
to only require remote scripts to be signed using Set-ExecutionPolicy RemoteSigned, or [sign the profile][sign].
Adjust the Oh My Posh init line in ~/.xonshrc by adding the --config flag with the location of your configuration.
execx($(oh-my-posh init xonsh --config ~/jandedobbeleer.omp.json))
Once added, reload your profile for the changes to take effect.
exec xonsh
Adjust the Oh My Posh init line in ~/.zshrc by adding the --config flag with the location of your configuration.
eval "$(oh-my-posh init zsh --config ~/jandedobbeleer.omp.json)"
Once altered, reload your profile for the changes to take effect.
exec zsh
Al usar oh-my-posh en Windows con WSL, puedes compartir tu tema con WSL apuntando a un tema ubicado en la carpeta personal de tu usuario de Windows.
Dentro de WSL, encontrarás la carpeta personal de tu usuario de Windows en: /mnt/c/Users/<WINDOWSUSERNAME>.
Configuración personalizada
Quizás te gusta un tema pero no sus colores. O tal vez quieras ajustar/añadir un segmento, o cambiar algunos iconos. Sea cual sea el caso, revisa primero las opciones disponibles comenzando por la configuración.
Puedes exportar el tema actual (predeterminado o configurado mediante --config) al formato que prefieras (json, yaml o toml)
para modificarlo y guardarlo como tu configuración personalizada.
oh-my-posh config export --config jandedobbeleer --output ~/.mytheme.omp.json
Recarga en vivo
Por razones de rendimiento, la configuración se almacena en caché por defecto. Si modificas tu archivo de configuración y quieres ver los cambios reflejados en tu prompt sin reiniciar el shell, usa este comando para activar la recarga en vivo.
oh-my-posh enable reload
Puedes desactivar la recarga en vivo con:
oh-my-posh disable reload
Previsualizar cambios
Si deseas previsualizar tus cambios, usa este comando para renderizar todos los prompts configurados.
oh-my-posh print preview
Usa la bandera --force si quieres renderizar todos los segmentos, independientemente del contexto actual.
oh-my-posh print preview --force
Consultar la documentación
Para personalizar completamente un tema, revisa la documentación sobre configuración y segmentos. La sección de configuración cubre los conceptos básicos y componentes de los temas de Oh My Posh, mientras que la sección de segmentos explica cómo configurar cada segmento disponible.