oh-my-posh/docs/docs/install-windows.mdx
2021-09-14 19:57:47 +02:00

267 lines
6.7 KiB
Plaintext

---
id: windows
title: Windows
sidebar_label: ⊞ Windows
---
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import Shells from "./install-shells.mdx";
import Customize from "./install-customize.md";
import CustomizeCmd from "./install-customize-cmd.mdx";
### Setup your terminal
While Oh My Posh works on the standard terminal, we advise using the [Windows Terminal][wt].
### Installation
<Tabs
defaultValue="winget"
groupId="install"
values={[
{ label: 'winget', value: 'winget', },
{ label: 'scoop', value: 'scoop', },
{ label: 'chocolatey', value: 'chocolatey'},
]
}>
<TabItem value="winget">
```powershell
winget install JanDeDobbeleer.OhMyPosh
```
This installs a couple of things:
- `oh-my-posh.exe` - Windows executable, added to your `$PATH`
- `oh-my-posh-wsl` - Linux executable, added to your `$PATH` for use in the WSL
- `themes` - The latest Oh My Posh themes
If you want to use a standard theme, you can find them in `~\AppData\Local\Programs\oh-my-posh\themes\`,
referencing them as such
will always keep them compatible with the binary when updating Oh My Posh.
</TabItem>
<TabItem value="scoop">
```powershell
scoop install https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/oh-my-posh.json
```
This installs a couple of things:
- `oh-my-posh.exe` - Windows executable, added to your `$PATH`
- `oh-my-posh-wsl` - Linux executable, added to your `$PATH` for use in the WSL
- `themes` - The latest Oh My Posh themes
If you want to use a standard theme, you can find them in `~\scoop\apps\oh-my-posh\current\themes\`,
referencing them as such
will always keep them compatible with the binary when updating Oh My Posh.
</TabItem>
<TabItem value="chocolatey">
:::info
The chocolatey package is managed by [Curtis Carter][cc]. In case of problems, please create an issue [here][cc-choco].
:::
```powershell
choco install oh-my-posh
```
This installs a couple of things:
- `oh-my-posh.exe` - Windows executable, added to your `$PATH`
- `oh-my-posh-wsl` - Linux executable, added to your `$PATH` for use in the WSL
- `themes` - The latest Oh My Posh themes
If you want to use a standard theme, you can find them in `~\AppData\Local\Programs\oh-my-posh\themes\`,
referencing them as such
will always keep them compatible with the binary when updating Oh My Posh.
</TabItem>
</Tabs>
For the `$PATH` to reload, a reboot is advised.
### Usage
#### Preview the themes
<Tabs
defaultValue="winget"
groupId="install"
values={[
{ label: 'winget', value: 'winget', },
{ label: 'scoop', value: 'scoop', },
{ label: 'chocolatey', value: 'chocolatey'},
]
}>
<TabItem value="winget">
```powershell
Get-ChildItem -Path "~\AppData\Local\Programs\oh-my-posh\themes\*" -Include '*.omp.json' | Sort-Object Name | ForEach-Object -Process {
$esc = [char]27
Write-Host ""
Write-Host "$esc[1m$($_.BaseName)$esc[0m"
Write-Host ""
oh-my-posh --config $($_.FullName) --pwd $PWD
Write-Host ""
}
```
</TabItem>
<TabItem value="scoop">
```powershell
Get-ChildItem -Path "$(scoop prefix oh-my-posh)\themes\*" -Include '*.omp.json' | Sort-Object Name | ForEach-Object -Process {
$esc = [char]27
Write-Host ""
Write-Host "$esc[1m$($_.BaseName)$esc[0m"
Write-Host ""
oh-my-posh --config $($_.FullName) --pwd $PWD
Write-Host ""
}
```
</TabItem>
<TabItem value="chocolatey">
```powershell
Get-ChildItem -Path "~\AppData\Local\Programs\oh-my-posh\themes\*" -Include '*.omp.json' | Sort-Object Name | ForEach-Object -Process {
$esc = [char]27
Write-Host ""
Write-Host "$esc[1m$($_.BaseName)$esc[0m"
Write-Host ""
oh-my-posh --config $($_.FullName) --pwd $PWD
Write-Host ""
}
```
</TabItem>
</Tabs>
#### Update
<Tabs
defaultValue="winget"
groupId="install"
values={[
{ label: 'winget', value: 'winget', },
{ label: 'scoop', value: 'scoop', },
{ label: 'chocolatey', value: 'chocolatey'},
]
}>
<TabItem value="winget">
```powershell
winget upgrade JanDeDobbeleer.OhMyPosh
```
</TabItem>
<TabItem value="scoop">
```powershell
scoop update oh-my-posh
```
</TabItem>
<TabItem value="chocolatey">
```powershell
choco upgrade oh-my-posh
```
</TabItem>
</Tabs>
### Replace your existing prompt
<Tabs
defaultValue="winget"
groupId="install"
values={[
{ label: 'winget', value: 'winget', },
{ label: 'scoop', value: 'scoop', },
{ label: 'chocolatey', value: 'chocolatey'},
]
}>
<TabItem value="winget">
You can find the themes winget installs inside the `~\AppData\Local\Programs\oh-my-posh\themes\` folder.
To use `jandedobbeleer.omp.json` for example, you can refer to it using `~\AppData\Local\Programs\oh-my-posh\themes\jandedobbeleer.omp.json`
when setting the prompt using the `--config` flag.
</TabItem>
<TabItem value="scoop">
You can find the themes scoop installs inside the `"$(scoop prefix oh-my-posh)\themes\"` folder.
To use `jandedobbeleer.omp.json` for example, you can refer to it using `"$(scoop prefix oh-my-posh)\themes\jandedobbeleer.omp.json"`
when setting the prompt using the `--config` flag.
</TabItem>
<TabItem value="chocolatey">
You can find the themes winget installs inside the `~\AppData\Local\Programs\oh-my-posh\themes\` folder.
To use `jandedobbeleer.omp.json` for example, you can refer to it using `~\AppData\Local\Programs\oh-my-posh\themes\jandedobbeleer.omp.json`
when setting the prompt using the `--config` flag.
</TabItem>
</Tabs>
The guides below assume you copied the theme called `jandedobbeleer.omp.json` to your user's `$HOME` folder.
Based on the installation method used, you can find this theme at the following location:
<Tabs
defaultValue="winget"
groupId="install"
values={[
{ label: 'winget', value: 'winget', },
{ label: 'scoop', value: 'scoop', },
{ label: 'chocolatey', value: 'chocolatey'},
]
}>
<TabItem value="winget">
`~\AppData\Local\Programs\oh-my-posh\themes\jandedobbeleer.omp.json`
</TabItem>
<TabItem value="scoop">
`"$(scoop prefix oh-my-posh)\themes\jandedobbeleer.omp.json"`
</TabItem>
<TabItem value="chocolatey">
`~\AppData\Local\Programs\oh-my-posh\themes\jandedobbeleer.omp.json`
</TabItem>
</Tabs>
:::caution
When using oh-my-posh inside the WSL, make sure to use the `oh-my-posh-wsl` executable instead.
:::
<Shells />
### Customize
<Customize />
:::tip
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, replace `~` with the following path: `/mnt/c/Users/<WINDOWSUSERNAME>`.
:::
<CustomizeCmd />
🎉🎉🎉
[scoop]: https://scoop.sh/
[wt]: https://github.com/microsoft/terminal
[powershell]: https://www.powershellgallery.com/packages/oh-my-posh
[cc]: https://github.com/digitalcoyote
[cc-choco]: https://github.com/digitalcoyote/chocolatey-packages/tree/master/oh-my-posh