import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";

:::tip
If you have no idea which shell you're currently using, Oh My Posh has a utility switch that can tell that to you.
:::

```bash
oh-my-posh --print-shell
```

<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">

Edit `$PROFILE` in your preferred PowerShell version and add the following line.

:::caution
If you installed Oh My Posh using `Install-Module oh-my-posh`, you need to first import
Oh My Posh in your `$PROFILE` before adding the line below:

```powershell
Import-Module oh-my-posh
```
:::

```powershell
oh-my-posh --init --shell pwsh --config ~/jandedobbeleer.omp.json | Invoke-Expression
```

Once added, reload your profile for the changes to take effect.

```powershell
. $PROFILE
```

</TabItem>
<TabItem value="cmd">

There's no out of the box support for Windows CMD when it comes to custom prompts.
There is however a way to do it using [Clink][clink], which at the same time supercharges
your cmd experience. Follow the installation instructions and make sure you select autostart.

Integrating Oh my Posh with Clink is easy: create a new file called oh-my-posh.lua in your Clink
scripts directory (run `clink info` inside cmd to find that file's location).

:::warning
Use the full path to the config file, not the relative path.
:::

```lua title="oh-my-posh.lua"
load(io.popen('oh-my-posh --config="C:/Users/jan/jandedobbeleer.omp.json" --init --shell cmd'):read("*a"))()
```

Once added, restart cmd for the changes to take effect.

</TabItem>
<TabItem value="zsh">

Add the following to `~/.zshrc`:

```bash
eval "$(oh-my-posh --init --shell zsh --config ~/jandedobbeleer.omp.json)"
```

Once added, reload your profile for the changes to take effect.

```bash
source ~/.zshrc
```

</TabItem>
<TabItem value="bash">

Add the following to `~/.bashrc` (could be `~/.profile` or `~/.bash_profile` depending on your environment):

```bash
eval "$(oh-my-posh --init --shell bash --config ~/jandedobbeleer.omp.json)"
```

Once added, reload your profile for the changes to take effect.

```bash
. ~/.bashrc
```

Or, when using `~/.profile`.

```bash
. ~/.profile
```

</TabItem>
<TabItem value="fish">

:::caution
It's advised to be on the latest version of fish. Versions below 3.1.2 have issues displaying the prompt.
:::

Initialize Oh My Posh in `~/.config/fish/config.fish`:

```bash
oh-my-posh --init --shell fish --config ~/jandedobbeleer.omp.json | source
```

Once added, reload your config for the changes to take effect.

```bash
. ~/.config/fish/config.fish
```

</TabItem>
<TabItem value="nu">

Set the prompt and restart nu shell:

### Nu < 0.32.0

```bash
config set prompt  "= `{{$(oh-my-posh --config ~/jandedobbeleer.omp.json | str collect)}}`"
```

### Nu >= 0.32.0

```bash
config set prompt  "(oh-my-posh --config ~/jandedobbeleer.omp.json | str collect)"
```

Restart nu shell for the changes to take effect.

</TabItem>
</Tabs>

[clink]: https://chrisant996.github.io/clink/
