2020-10-05 02:33:12 -07:00
|
|
|
---
|
2022-04-20 09:43:59 -07:00
|
|
|
id: overview
|
2021-11-15 10:20:27 -08:00
|
|
|
title: General
|
|
|
|
sidebar_label: General
|
2020-10-05 02:33:12 -07:00
|
|
|
---
|
|
|
|
|
2021-06-05 10:27:33 -07:00
|
|
|
Oh My Posh renders your prompt based on the definition of _blocks_ (like Lego) which contain one or more _segments_.
|
2021-11-12 10:14:16 -08:00
|
|
|
A really simple configuration could look like this. The default format is `json`, but we also support `toml` and `yaml`.
|
|
|
|
There's a [schema][schema] available which is kept up-to-date and helps with autocomplete and validation of the configuration.
|
|
|
|
|
|
|
|
:::info
|
|
|
|
There are a few [themes][themes] available which are basically predefined configs. You can use these as they are, or as a
|
|
|
|
starting point to create your own configuration.
|
|
|
|
:::
|
2020-10-05 02:33:12 -07:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2021-11-12 10:14:16 -08:00
|
|
|
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
|
2020-10-05 02:33:12 -07:00
|
|
|
"final_space": true,
|
|
|
|
"blocks": [
|
|
|
|
{
|
|
|
|
"type": "prompt",
|
|
|
|
"alignment": "left",
|
|
|
|
"segments": [
|
|
|
|
{
|
|
|
|
"type": "path",
|
|
|
|
"style": "powerline",
|
2020-10-15 23:37:43 -07:00
|
|
|
"powerline_symbol": "\uE0B0",
|
2020-10-05 02:33:12 -07:00
|
|
|
"foreground": "#ffffff",
|
|
|
|
"background": "#61AFEF",
|
|
|
|
"properties": {
|
|
|
|
"style": "folder"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
With this configuration, a single powerline segment is rendered that shows the name of the folder you're currently in.
|
2021-06-05 10:27:33 -07:00
|
|
|
To set this configuration in combination with a Oh My Posh [executable][releases], use the `--config` flag to
|
2021-07-01 10:35:09 -07:00
|
|
|
set a path to a JSON file containing the above code. The `--shell universal` flag is used to print the prompt without
|
2020-11-04 02:41:34 -08:00
|
|
|
escape characters to see the prompt as it would be shown inside a prompt function for your shell.
|
|
|
|
|
2021-09-01 04:45:33 -07:00
|
|
|
:::caution
|
2020-11-04 02:41:34 -08:00
|
|
|
The command below will not persist the configuration for your shell but print the prompt in your terminal.
|
2021-06-03 11:01:46 -07:00
|
|
|
If you want to use your own configuration permanently, adjust the prompt configuration to use your custom
|
2020-11-04 02:41:34 -08:00
|
|
|
theme.
|
|
|
|
:::
|
2020-10-05 02:33:12 -07:00
|
|
|
|
|
|
|
```bash
|
2022-03-25 11:03:37 -07:00
|
|
|
oh-my-posh print primary --config sample.json --shell uni
|
2020-10-05 02:33:12 -07:00
|
|
|
```
|
|
|
|
|
2020-11-13 04:24:08 -08:00
|
|
|
If all goes according to plan, you should see the prompt being printed out on the line below. In case you see a lot of
|
2021-11-12 10:14:16 -08:00
|
|
|
boxes with question marks, set up your terminal to use a [supported font][font] before continuing.
|
2020-10-05 02:33:12 -07:00
|
|
|
|
2022-03-09 09:14:11 -08:00
|
|
|
:::tip
|
|
|
|
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'`
|
|
|
|
:::
|
|
|
|
|
2020-10-05 02:33:12 -07:00
|
|
|
## General Settings
|
|
|
|
|
2020-10-12 00:02:33 -07:00
|
|
|
- final_space: `boolean` - when true adds a space at the end of the prompt
|
2021-02-15 13:19:19 -08:00
|
|
|
- osc99: `boolean` - when true adds support for OSC9;9; (notify terminal of current working directory)
|
2021-03-14 06:14:08 -07:00
|
|
|
- terminal_background: `string` [color][colors] - terminal background color, set to your terminal's background color when
|
|
|
|
you notice black elements in Windows Terminal or the Visual Studio Code integrated terminal
|
2020-10-05 02:33:12 -07:00
|
|
|
|
2021-02-15 23:36:37 -08:00
|
|
|
[releases]: https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest
|
2022-04-20 09:43:59 -07:00
|
|
|
[font]: /docs/configuration/fonts
|
2021-11-12 10:14:16 -08:00
|
|
|
[schema]: https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/themes/schema.json
|
|
|
|
[themes]: https://github.com/JanDeDobbeleer/oh-my-posh/tree/main/themes
|