2022-03-09 02:39:31 -08:00
|
|
|
---
|
|
|
|
id: customize
|
|
|
|
title: Customize
|
|
|
|
sidebar_label: 💅🏼 Customize
|
|
|
|
---
|
|
|
|
|
2021-04-24 03:58:23 -07:00
|
|
|
import Tabs from "@theme/Tabs";
|
2022-03-18 05:38:20 -07:00
|
|
|
import TabItem from "@theme/TabItem"
|
2021-04-24 03:58:23 -07:00
|
|
|
|
2022-10-12 05:59:37 -07:00
|
|
|
The standard initialization sets Oh My Posh' default theme. This configuration is embedded
|
|
|
|
and thus kept up-to-date with Oh My Posh.
|
2022-08-07 02:30:01 -07:00
|
|
|
|
2022-10-12 05:59:37 -07:00
|
|
|
To set a new config/theme you need to change the `--config` option of the `oh-my-posh init <shell>`
|
|
|
|
line in your `profile` or `.<shell>rc` script (see [prompt][prompt]) and point it to the location of a
|
|
|
|
predefined [theme][themes] or custom configuration.
|
2022-09-06 22:27:49 -07:00
|
|
|
|
|
|
|
There are two possible values the `--config` flag can handle:
|
|
|
|
|
|
|
|
- a path to a local configuration file
|
|
|
|
|
|
|
|
```powershell
|
|
|
|
oh-my-posh init pwsh --config 'C:/Users/Posh/jandedobbeleer.omp.json' | Invoke-Expression
|
|
|
|
```
|
|
|
|
|
|
|
|
- a URL pointing to a remote config
|
|
|
|
|
|
|
|
```powershell
|
|
|
|
oh-my-posh init pwsh --config 'https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/jandedobbeleer.omp.json' | Invoke-Expression
|
|
|
|
```
|
|
|
|
|
|
|
|
### Get inspiration
|
|
|
|
|
|
|
|
The Windows and homebrew installers also bundle the **predefined configurations** ([themes][themes]). You can use the
|
|
|
|
following way to reference them directly. This will keep them up-to-date and compatible with future updates.
|
2022-08-07 02:30:01 -07:00
|
|
|
|
|
|
|
<Tabs
|
|
|
|
defaultValue="windows"
|
|
|
|
groupId="shell"
|
|
|
|
values={[
|
|
|
|
{ label: 'windows', value: 'windows', },
|
|
|
|
{ label: 'homebrew', value: 'homebrew', },
|
|
|
|
]
|
|
|
|
}>
|
|
|
|
<TabItem value="windows">
|
|
|
|
|
|
|
|
For example, to use the [jandedobbeleer][jandedobbeleer] theme, alter the init line like this (`powershell`):
|
|
|
|
|
|
|
|
```powershell
|
2022-08-07 09:31:31 -07:00
|
|
|
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/jandedobbeleer.omp.json" | Invoke-Expression
|
2022-08-07 02:30:01 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
</TabItem>
|
|
|
|
<TabItem value="homebrew">
|
|
|
|
|
|
|
|
When using homebrew, all themes are installed alongside Oh My Posh in `$(brew --prefix oh-my-posh)/themes`.
|
|
|
|
To use any of the themes, use the following syntax (`zsh`):
|
|
|
|
|
|
|
|
```bash
|
|
|
|
eval "$(oh-my-posh init zsh --config $(brew --prefix oh-my-posh)/themes/jandedobbeleer.omp.json)"
|
|
|
|
```
|
|
|
|
|
|
|
|
</TabItem>
|
|
|
|
</Tabs>
|
2022-03-18 05:15:57 -07:00
|
|
|
|
2022-09-06 22:27:49 -07:00
|
|
|
### Config syntax
|
2022-03-18 05:38:20 -07:00
|
|
|
|
2022-09-06 22:27:49 -07:00
|
|
|
The examples below use a local path to the [jandedobbeleer][jandedobbeleer] theme, adjust the `--config` value
|
|
|
|
to reflect your use-case.
|
2022-03-18 05:15:57 -07:00
|
|
|
|
|
|
|
<Tabs
|
|
|
|
defaultValue="powershell"
|
|
|
|
groupId="shell"
|
|
|
|
values={[
|
|
|
|
{ label: 'bash', value: 'bash', },
|
2023-02-18 07:46:31 -08:00
|
|
|
{ label: 'cmd', value: 'cmd', },
|
|
|
|
{ label: 'elvish', value: 'elvish', },
|
2022-03-18 05:15:57 -07:00
|
|
|
{ label: 'fish', value: 'fish', },
|
|
|
|
{ label: 'nu', value: 'nu', },
|
2023-02-18 07:46:31 -08:00
|
|
|
{ label: 'powershell', value: 'powershell', },
|
2023-02-17 01:11:44 -08:00
|
|
|
{ label: 'tcsh', value: 'tcsh', },
|
2023-02-18 07:46:31 -08:00
|
|
|
{ label: 'xonsh', value: 'xonsh', },
|
|
|
|
{ label: 'zsh', value: 'zsh', },
|
2022-03-18 05:15:57 -07:00
|
|
|
]
|
|
|
|
}>
|
2023-02-18 07:46:31 -08:00
|
|
|
<TabItem value="bash">
|
2023-02-17 01:11:44 -08:00
|
|
|
|
2023-02-18 07:46:31 -08:00
|
|
|
:::caution Git bash
|
|
|
|
Use the full path to the config file, not the relative path or `~` as a shorthand for `$HOME`.
|
|
|
|
:::
|
2022-03-18 05:15:57 -07:00
|
|
|
|
2023-03-01 11:37:53 -08:00
|
|
|
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.
|
2022-03-18 05:15:57 -07:00
|
|
|
|
2023-02-18 07:46:31 -08:00
|
|
|
```bash
|
|
|
|
eval "$(oh-my-posh init bash --config ~/jandedobbeleer.omp.json)"
|
2022-03-18 05:15:57 -07:00
|
|
|
```
|
|
|
|
|
2023-02-18 07:46:31 -08:00
|
|
|
Once altered, reload your profile for the changes to take effect.
|
2022-07-10 00:35:42 -07:00
|
|
|
|
2023-02-18 07:46:31 -08:00
|
|
|
```bash
|
|
|
|
exec bash
|
2022-07-10 00:35:42 -07:00
|
|
|
```
|
2023-01-22 22:39:22 -08:00
|
|
|
|
2022-03-18 05:15:57 -07:00
|
|
|
</TabItem>
|
|
|
|
<TabItem value="cmd">
|
|
|
|
|
2023-03-01 11:37:53 -08:00
|
|
|
Adjust the Oh My Posh init line in `oh-my-posh.lua` by adding the `--config` flag with the location
|
|
|
|
of your configuration.
|
2023-02-17 01:11:44 -08:00
|
|
|
|
2022-03-18 05:15:57 -07:00
|
|
|
```lua title="oh-my-posh.lua"
|
2022-09-06 22:27:49 -07:00
|
|
|
load(io.popen('oh-my-posh init cmd --config C:/Users/Posh/jandedobbeleer.omp.json'):read("*a"))()
|
2022-03-18 05:15:57 -07:00
|
|
|
```
|
|
|
|
|
2022-09-06 22:27:49 -07:00
|
|
|
:::caution
|
|
|
|
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.
|
|
|
|
:::
|
|
|
|
|
2022-03-18 05:15:57 -07:00
|
|
|
Once altered, restart cmd for the changes to take effect.
|
|
|
|
|
|
|
|
</TabItem>
|
2023-02-18 07:46:31 -08:00
|
|
|
<TabItem value="elvish">
|
2023-02-04 02:30:02 -08:00
|
|
|
|
2023-03-01 11:37:53 -08:00
|
|
|
Adjust the Oh My Posh init line in `~/.elvish/rc.elv` by adding the `--config` flag with the location
|
|
|
|
of your configuration.
|
2023-02-17 01:11:44 -08:00
|
|
|
|
2022-03-18 05:15:57 -07:00
|
|
|
```bash
|
2023-02-18 07:46:31 -08:00
|
|
|
eval (oh-my-posh init elvish --config ~/jandedobbeleer.omp.json)
|
2022-03-18 05:15:57 -07:00
|
|
|
```
|
|
|
|
|
2023-02-18 07:46:31 -08:00
|
|
|
Once added, reload your profile for the changes to take effect.
|
2022-03-18 05:15:57 -07:00
|
|
|
|
|
|
|
```bash
|
2023-02-18 07:46:31 -08:00
|
|
|
exec elvish
|
2022-03-18 05:15:57 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
</TabItem>
|
|
|
|
<TabItem value="fish">
|
|
|
|
|
2022-08-23 06:53:32 -07:00
|
|
|
:::caution
|
|
|
|
Oh My Posh requires fish v3.4.0 or higher.
|
|
|
|
:::
|
|
|
|
|
2023-03-01 11:37:53 -08:00
|
|
|
Adjust the Oh My Posh init line in `~/.config/fish/config.fish` by adding the `--config` flag with
|
|
|
|
the location of your configuration.
|
2023-02-17 01:11:44 -08:00
|
|
|
|
2022-03-18 05:15:57 -07:00
|
|
|
```bash
|
2022-09-06 22:27:49 -07:00
|
|
|
oh-my-posh init fish --config ~/jandedobbeleer.omp.json | source
|
2022-03-18 05:15:57 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
Once altered, reload your config for the changes to take effect.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
. ~/.config/fish/config.fish
|
|
|
|
```
|
|
|
|
|
|
|
|
</TabItem>
|
|
|
|
<TabItem value="nu">
|
|
|
|
|
2022-08-09 23:42:18 -07:00
|
|
|
:::caution
|
2023-10-18 01:58:13 -07:00
|
|
|
Oh My Posh requires Nushell v0.86.0 or higher.
|
2022-05-20 00:12:21 -07:00
|
|
|
:::
|
2022-03-18 05:15:57 -07:00
|
|
|
|
2023-03-01 11:37:53 -08:00
|
|
|
Adjust the Oh My Posh init line in the Nushell env file (`$nu.env-path`) by adding the `--config` flag
|
|
|
|
with the location of your configuration.
|
2022-03-18 05:15:57 -07:00
|
|
|
|
|
|
|
```bash
|
2022-09-06 22:27:49 -07:00
|
|
|
oh-my-posh init nu --config ~/jandedobbeleer.omp.json
|
2022-08-07 09:29:54 -07:00
|
|
|
```
|
|
|
|
|
2023-01-10 10:59:00 -08:00
|
|
|
This saves the initialization script to `~/.oh-my-posh.nu`.
|
|
|
|
Now, edit the Nushell config file (`$nu.config-path`) and add the following line at the bottom:
|
2022-08-07 09:29:54 -07:00
|
|
|
|
|
|
|
```bash
|
2022-05-20 00:12:21 -07:00
|
|
|
source ~/.oh-my-posh.nu
|
2022-03-18 05:15:57 -07:00
|
|
|
```
|
|
|
|
|
2023-01-10 10:59:00 -08:00
|
|
|
If you want to save the initialization script elsewhere, you can change the first line to something like this:
|
2022-03-24 01:09:51 -07:00
|
|
|
|
|
|
|
```bash
|
2023-01-10 10:59:00 -08:00
|
|
|
oh-my-posh init nu --config ~/jandedobbeleer.omp.json --print | save /mylocation/myscript.nu --force
|
2022-08-07 09:29:54 -07:00
|
|
|
```
|
|
|
|
|
2023-01-10 10:59:00 -08:00
|
|
|
And change the `source` line to:
|
2022-08-07 09:29:54 -07:00
|
|
|
|
|
|
|
```bash
|
2022-05-20 00:12:21 -07:00
|
|
|
source /mylocation/myscript.nu
|
2022-03-24 01:09:51 -07:00
|
|
|
```
|
|
|
|
|
2022-08-07 09:29:54 -07:00
|
|
|
Once altered, restart Nushell for the changes to take effect.
|
2022-03-18 05:15:57 -07:00
|
|
|
|
2023-02-18 07:46:31 -08:00
|
|
|
</TabItem>
|
|
|
|
<TabItem value="powershell">
|
|
|
|
|
2023-03-01 11:37:53 -08:00
|
|
|
Adjust the Oh My Posh init line in your `$PROFILE` by adding the `--config` flag with the location
|
|
|
|
of your configuration.
|
2023-02-18 07:46:31 -08:00
|
|
|
|
|
|
|
```powershell
|
|
|
|
oh-my-posh init pwsh --config ~/jandedobbeleer.omp.json | Invoke-Expression
|
|
|
|
```
|
|
|
|
|
|
|
|
Once altered, reload your profile for the changes to take effect.
|
|
|
|
|
|
|
|
```powershell
|
|
|
|
. $PROFILE
|
|
|
|
```
|
|
|
|
|
|
|
|
:::info
|
|
|
|
When the above command gives an error, make sure to create the profile first and add the `oh-my-posh init` above.
|
|
|
|
|
|
|
|
```powershell
|
|
|
|
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].
|
|
|
|
:::
|
|
|
|
|
2023-02-17 01:11:44 -08:00
|
|
|
</TabItem>
|
|
|
|
<TabItem value="tcsh">
|
|
|
|
|
2023-03-01 11:37:53 -08:00
|
|
|
Adjust the Oh My Posh init line in `~/.tcshrc` by adding the `--config` flag with the location of your configuration.
|
2023-02-17 01:11:44 -08:00
|
|
|
|
|
|
|
```bash
|
|
|
|
eval `oh-my-posh init tcsh --config ~/jandedobbeleer.omp.json`
|
|
|
|
```
|
|
|
|
|
|
|
|
Once added, reload your profile for the changes to take effect.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
exec tcsh
|
|
|
|
```
|
|
|
|
|
2023-02-18 04:49:10 -08:00
|
|
|
</TabItem>
|
2023-02-18 07:46:31 -08:00
|
|
|
<TabItem value="xonsh">
|
2023-02-18 04:49:10 -08:00
|
|
|
|
2023-03-01 11:37:53 -08:00
|
|
|
Adjust the Oh My Posh init line in `~/.xonshrc` by adding the `--config` flag with the location of your configuration.
|
2023-02-18 04:49:10 -08:00
|
|
|
|
|
|
|
```bash
|
2023-02-18 07:46:31 -08:00
|
|
|
execx($(oh-my-posh init xonsh --config ~/jandedobbeleer.omp.json))
|
2023-02-18 04:49:10 -08:00
|
|
|
```
|
|
|
|
|
|
|
|
Once added, reload your profile for the changes to take effect.
|
|
|
|
|
|
|
|
```bash
|
2023-02-18 07:46:31 -08:00
|
|
|
exec xonsh
|
|
|
|
```
|
|
|
|
|
|
|
|
</TabItem>
|
|
|
|
<TabItem value="zsh">
|
|
|
|
|
2023-03-01 11:37:53 -08:00
|
|
|
Adjust the Oh My Posh init line in `~/.zshrc` by adding the `--config` flag with the location of your configuration.
|
2023-02-18 07:46:31 -08:00
|
|
|
|
|
|
|
```bash
|
|
|
|
eval "$(oh-my-posh init zsh --config ~/jandedobbeleer.omp.json)"
|
|
|
|
```
|
|
|
|
|
|
|
|
Once altered, reload your profile for the changes to take effect.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
exec zsh
|
2023-02-18 04:49:10 -08:00
|
|
|
```
|
|
|
|
|
2022-03-18 05:15:57 -07:00
|
|
|
</TabItem>
|
|
|
|
</Tabs>
|
|
|
|
|
2022-03-18 05:38:20 -07:00
|
|
|
:::tip wsl
|
|
|
|
When using oh-my-posh in Windows and the WSL, know that you can **share your theme with the WSL** by pointing to a theme in your
|
2022-03-09 02:39:31 -08:00
|
|
|
Windows user's home folder.
|
|
|
|
|
|
|
|
Inside the WSL, you can find your Windows user's home folder here: `/mnt/c/Users/<WINDOWSUSERNAME>`.
|
|
|
|
:::
|
|
|
|
|
2022-09-06 22:27:49 -07:00
|
|
|
### Adjust a theme
|
2021-04-24 03:58:23 -07:00
|
|
|
|
2022-03-18 05:38:20 -07:00
|
|
|
Maybe there's a theme you like, but you don't fancy the colors. Or, maybe there's a segment you
|
|
|
|
want to tweak/add, or replace some of the icons with a different one. Whatever the case, **read through
|
2023-10-15 22:31:32 -07:00
|
|
|
available options first**, by starting with the [configuration][configuration].
|
2021-04-24 03:58:23 -07:00
|
|
|
|
2022-06-03 13:35:11 -07:00
|
|
|
You can export the current theme (default, or set via `--config`) to the format you like (`json`, `yaml`, or `toml`)
|
2022-03-18 05:38:20 -07:00
|
|
|
which can be used to tweak and store as your own custom theme.
|
2021-04-24 03:58:23 -07:00
|
|
|
|
|
|
|
```bash
|
2022-03-21 12:48:42 -07:00
|
|
|
oh-my-posh config export --output ~/.mytheme.omp.json
|
2021-04-24 03:58:23 -07:00
|
|
|
```
|
|
|
|
|
2022-09-06 22:27:49 -07:00
|
|
|
:::caution
|
|
|
|
Be careful not to adjust the theme files in their original location as they're updated together with Oh My Posh
|
|
|
|
which will remove your customizations. Always copy, or export them and save the new configuration outside of the
|
|
|
|
Oh My Posh internal themes folder.
|
|
|
|
:::
|
|
|
|
|
2022-06-03 13:35:11 -07:00
|
|
|
### Read the docs
|
|
|
|
|
|
|
|
To fully understand how to customize a theme, read through the documentation in the configuration and segments sections.
|
|
|
|
The [configuration][configuration] section covers the basic building blocks and concepts of Oh My Posh themes, while the
|
|
|
|
segments section covers how to configure each available segment.
|
2022-03-09 02:39:31 -08:00
|
|
|
|
|
|
|
[themes]: themes.md
|
2023-10-15 22:31:32 -07:00
|
|
|
[configuration]: configuration/general.mdx
|
2022-08-07 02:30:01 -07:00
|
|
|
[prompt]: prompt.mdx
|
2022-03-18 05:15:57 -07:00
|
|
|
[jandedobbeleer]: /docs/themes#jandedobbeleer
|
2022-07-01 12:41:47 -07:00
|
|
|
[json-schema]: https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
|
2022-08-09 22:46:35 -07:00
|
|
|
[homebrew-problem]: https://github.com/JanDeDobbeleer/oh-my-posh/discussions/2644
|
2023-01-22 22:39:22 -08:00
|
|
|
[sign]: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_signing?view=powershell-7.3#methods-of-signing-scripts
|