mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-10 13:04:04 -08:00
160 lines
4.4 KiB
Plaintext
160 lines
4.4 KiB
Plaintext
---
|
|
id: customize
|
|
title: Customize
|
|
sidebar_label: 💅🏼 Customize
|
|
---
|
|
|
|
import Tabs from "@theme/Tabs";
|
|
import TabItem from "@theme/TabItem"
|
|
|
|
The standard initialization sets Oh My Posh' [default theme][default-theme]. This configuration is downloaded
|
|
and kept up-to-date with Oh My Posh' version every time the shell starts. To change/alter the configuration, you need to
|
|
add the `--config` command-line option to change the configuration to use a specific file.
|
|
|
|
### Get inspiration
|
|
|
|
The best place to get started is by looking at the [themes][themes], as these are **predefined configurations** to use/alter.
|
|
To change to for example the [jandedobbeleer][jandedobbeleer] theme, alter the Oh My Posh `init` line to the following (assuming you
|
|
downloaded the configuration file to your user's home folder):
|
|
|
|
<Tabs
|
|
defaultValue="powershell"
|
|
groupId="shell"
|
|
values={[
|
|
{ label: 'powershell', value: 'powershell', },
|
|
{ label: 'cmd', value: 'cmd', },
|
|
{ label: 'zsh', value: 'zsh', },
|
|
{ label: 'bash', value: 'bash', },
|
|
{ label: 'fish', value: 'fish', },
|
|
{ label: 'nu', value: 'nu', },
|
|
]
|
|
}>
|
|
<TabItem value="powershell">
|
|
|
|
```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
|
|
```
|
|
|
|
</TabItem>
|
|
<TabItem value="cmd">
|
|
|
|
```lua title="oh-my-posh.lua"
|
|
load(io.popen('oh-my-posh init cmd --config ~/.jandedobbeleer.omp.json'):read("*a"))()
|
|
```
|
|
|
|
Once altered, restart cmd for the changes to take effect.
|
|
|
|
</TabItem>
|
|
<TabItem value="zsh">
|
|
|
|
```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
|
|
```
|
|
|
|
</TabItem>
|
|
<TabItem value="bash">
|
|
|
|
```bash
|
|
eval "$(oh-my-posh init bash --config ~/.jandedobbeleer.omp.json)"
|
|
```
|
|
|
|
Once altered, reload your profile for the changes to take effect.
|
|
|
|
```bash
|
|
exec bash
|
|
```
|
|
|
|
</TabItem>
|
|
<TabItem value="fish">
|
|
|
|
```bash
|
|
oh-my-posh init fish --config ~/.jandedobbeleer.omp.json | source
|
|
```
|
|
|
|
Once altered, reload your config for the changes to take effect.
|
|
|
|
```bash
|
|
. ~/.config/fish/config.fish
|
|
```
|
|
|
|
</TabItem>
|
|
<TabItem value="nu">
|
|
|
|
:::warning
|
|
Oh My Posh requires Nushell >= 0.60.0
|
|
:::
|
|
|
|
Edit `$nu.configuration/path` and add the following lines at the bottom.
|
|
|
|
```bash
|
|
oh-my-posh init nu --config ~/.jandedobbeleer.omp.json
|
|
source ~/.oh-my-posh.nu
|
|
```
|
|
|
|
If you want to save the initialization script elsewhere, replace the lines above with these:
|
|
|
|
```bash
|
|
oh-my-posh init nu --config ~/.jandedobbeleer.omp.json --print | save /mylocation/myscript.nu
|
|
source /mylocation/myscript.nu
|
|
```
|
|
|
|
Once altered, restart nu shell for the changes to take effect.
|
|
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
:::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
|
|
Windows user's home folder.
|
|
|
|
Inside the WSL, you can find your Windows user's home folder here: `/mnt/c/Users/<WINDOWSUSERNAME>`.
|
|
:::
|
|
|
|
:::tip remote config
|
|
The `--config` flag can accept either a local filepath or a remotely hosted config file.
|
|
|
|
For example, the following is a valid `--config` flag:
|
|
|
|
```
|
|
--config 'https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/jandedobbeleer.omp.json'
|
|
```
|
|
:::
|
|
|
|
### Export the current theme
|
|
|
|
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
|
|
available options first**, by starting with the [configuration guide][configuration].
|
|
|
|
You can export the current theme (default, or set via `--config`) to the format you like (`json`, `yaml`, or `toml`)
|
|
which can be used to tweak and store as your own custom theme.
|
|
|
|
|
|
```bash
|
|
oh-my-posh config export --output ~/.mytheme.omp.json
|
|
```
|
|
|
|
### 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.
|
|
|
|
[themes]: themes.md
|
|
[configuration]: configuration/overview.mdx
|
|
[default-theme]: https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/themes/default.omp.json
|
|
[jandedobbeleer]: /docs/themes#jandedobbeleer
|
|
[json-schema]: https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
|