mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
docs: rework installation guide
This commit is contained in:
parent
842ba0d4c6
commit
af5ec20055
85
docs/docs/install-customize-cmd.mdx
Normal file
85
docs/docs/install-customize-cmd.mdx
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
import Tabs from "@theme/Tabs";
|
||||||
|
import TabItem from "@theme/TabItem";
|
||||||
|
|
||||||
|
<Tabs
|
||||||
|
defaultValue="powershell"
|
||||||
|
groupId="shell"
|
||||||
|
values={[
|
||||||
|
{ label: 'powershell', value: 'powershell', },
|
||||||
|
{ label: 'zsh', value: 'zsh', },
|
||||||
|
{ label: 'bash', value: 'bash', },
|
||||||
|
{ label: 'fish', value: 'fish', },
|
||||||
|
{ label: 'nu', value: 'nu', },
|
||||||
|
]
|
||||||
|
}>
|
||||||
|
<TabItem value="powershell">
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Export-PoshTheme -FilePath ~/.mytheme.omp.json -Format json
|
||||||
|
```
|
||||||
|
|
||||||
|
Once you're done editing, adjust your `$PROFILE` to use your newly created theme.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Invoke-Expression (oh-my-posh --init --shell pwsh --config ~/mytheme.omp.json)
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="zsh">
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export_poshconfig "~/.mytheme.omp.json" json
|
||||||
|
```
|
||||||
|
|
||||||
|
Once you're done editing, adjust `~/.zshrc` to use your newly created theme.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
eval "$(oh-my-posh --init --shell zsh --config ~/.mytheme.omp.json)"
|
||||||
|
```
|
||||||
|
|
||||||
|
When adjusted, reload your profile for the changes to take effect.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
. ~/.zshrc
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="bash">
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export_poshconfig "~/.mytheme.omp.json" json
|
||||||
|
```
|
||||||
|
|
||||||
|
Once you're done editing, adjust `~/.bashrc` to use your newly created theme.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
eval "$(oh-my-posh --init --shell bash --config ~/.mytheme.omp.json)"
|
||||||
|
```
|
||||||
|
|
||||||
|
When adjusted, reload your profile for the changes to take effect.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
. ~/.bashrc
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="fish">
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export_poshconfig "~/.mytheme.omp.json" json
|
||||||
|
```
|
||||||
|
|
||||||
|
Once you're done editing, adjust `config.fish` to use your newly created theme.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
oh-my-posh --init --shell fish --config ~/.mytheme.omp.json | source
|
||||||
|
```
|
||||||
|
|
||||||
|
Once adjusted, reload your config for the changes to take effect.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
. ~/.config/fish/config.fish
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</Tabs>
|
21
docs/docs/install-customize.md
Normal file
21
docs/docs/install-customize.md
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<!-- markdownlint-disable-next-line MD041 -->
|
||||||
|
At this point you're good to go. The `jandedobbeleer.omp.json` theme displays most common use-cases
|
||||||
|
in your prompt so 9/10 you'll be more than happy with it. However, if you want to explore additional
|
||||||
|
functionality, going through the additional steps below will help you get started.
|
||||||
|
|
||||||
|
#### Change the theme
|
||||||
|
|
||||||
|
We downloaded all the themes and set `jandedobbeleer.omp.json` as the one to use.
|
||||||
|
However, there are [a lot more][themes] to be discovered and maybe there are some you like better.
|
||||||
|
|
||||||
|
#### Override the theme settings
|
||||||
|
|
||||||
|
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 all
|
||||||
|
available options first, by starting with the [configuration guide][configuration].
|
||||||
|
|
||||||
|
You can output the current theme to the format you like (`json`, `yaml` or `toml`) which can be used to tweak
|
||||||
|
and store as your custom theme.
|
||||||
|
|
||||||
|
[themes]: themes.md
|
||||||
|
[configuration]: configuration.md
|
59
docs/docs/install-linux.mdx
Normal file
59
docs/docs/install-linux.mdx
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
---
|
||||||
|
id: linux
|
||||||
|
title: Linux
|
||||||
|
sidebar_label: 🐧 Linux
|
||||||
|
---
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
Oh my Posh uses ANSI color codes under the hood, these should work in every terminal,
|
||||||
|
but you may have to set the environment variable `$TERM` to `xterm-256color` for it to work.
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
|
||||||
|
sudo chmod +x /usr/local/bin/oh-my-posh
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Download the themes
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir ~/.poshthemes
|
||||||
|
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/themes.zip -O ~/.poshthemes/themes.zip
|
||||||
|
unzip ~/.poshthemes/themes.zip -d ~/.poshthemes
|
||||||
|
chmod u+rw ~/.poshthemes/*.json
|
||||||
|
rm ~/.poshthemes/themes.zip
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Preview the themes
|
||||||
|
|
||||||
|
```bash
|
||||||
|
for file in ~/.poshthemes/*.omp.json; do echo "$file\n"; oh-my-posh --config $file --shell universal; echo "\n"; done;
|
||||||
|
```
|
||||||
|
|
||||||
|
### Replace your existing prompt
|
||||||
|
|
||||||
|
<Shells />
|
||||||
|
|
||||||
|
### Customize
|
||||||
|
|
||||||
|
<Customize />
|
||||||
|
|
||||||
|
<CustomizeCmd />
|
||||||
|
|
||||||
|
🎉🎉🎉
|
||||||
|
|
||||||
|
[scoop]: https://scoop.sh/
|
||||||
|
[wt]: https://github.com/microsoft/terminal
|
||||||
|
[iterm2]: https://www.iterm2.com/
|
||||||
|
[powershell]: https://www.powershellgallery.com/packages/oh-my-posh
|
||||||
|
[brew]: https://brew.sh
|
||||||
|
[prompt]: /docs/installation#3-replace-your-existing-prompt
|
||||||
|
[configuration]: /docs/configure
|
65
docs/docs/install-macos.mdx
Normal file
65
docs/docs/install-macos.mdx
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
---
|
||||||
|
id: macos
|
||||||
|
title: macOS
|
||||||
|
sidebar_label: 🍏 macOS
|
||||||
|
---
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
As the standard terminal has issues displaying the ANSI characters correctly, we advise using
|
||||||
|
[iTerm2][iterm2] or any other modern day MacOS terminal that supports ANSI characters.
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
A [Homebrew][brew] formula is available for easy installation.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew tap jandedobbeleer/oh-my-posh
|
||||||
|
brew install oh-my-posh
|
||||||
|
```
|
||||||
|
|
||||||
|
This installs two things:
|
||||||
|
|
||||||
|
- `oh-my-posh` - Executable, added to `/usr/local/bin`
|
||||||
|
- `themes` - The latest Oh my Posh themes
|
||||||
|
|
||||||
|
If you want to use a standard theme, you can find them in `$(brew --prefix oh-my-posh)/themes`, referencing them as such
|
||||||
|
will always keep them compatible with the binary when updating Oh my Posh.
|
||||||
|
|
||||||
|
#### Preview the themes
|
||||||
|
|
||||||
|
```bash
|
||||||
|
for file in $(brew --prefix oh-my-posh)/themes/*.omp.json; do echo "$file\n"; oh-my-posh --config $file --shell universal; echo "\n"; done;
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Update
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew upgrade oh-my-posh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Replace your existing prompt
|
||||||
|
|
||||||
|
<Shells />
|
||||||
|
|
||||||
|
### Customize
|
||||||
|
|
||||||
|
<Customize />
|
||||||
|
|
||||||
|
<CustomizeCmd />
|
||||||
|
|
||||||
|
🎉🎉🎉
|
||||||
|
|
||||||
|
[scoop]: https://scoop.sh/
|
||||||
|
[wt]: https://github.com/microsoft/terminal
|
||||||
|
[iterm2]: https://www.iterm2.com/
|
||||||
|
[powershell]: https://www.powershellgallery.com/packages/oh-my-posh
|
||||||
|
[brew]: https://brew.sh
|
||||||
|
[prompt]: /docs/installation#3-replace-your-existing-prompt
|
||||||
|
[configuration]: /docs/configure
|
80
docs/docs/install-pwsh.mdx
Normal file
80
docs/docs/install-pwsh.mdx
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
---
|
||||||
|
id: pwsh
|
||||||
|
title: PowerShell
|
||||||
|
sidebar_label: 🐚 PowerShell
|
||||||
|
---
|
||||||
|
|
||||||
|
import Tabs from "@theme/Tabs";
|
||||||
|
import TabItem from "@theme/TabItem";
|
||||||
|
import Customize from "./install-customize.md";
|
||||||
|
|
||||||
|
:::info
|
||||||
|
This guide is for usage inside PowerShell only. If you plan to use Oh my Posh inside other shells as well,
|
||||||
|
have a look at the platform specific install instructions.
|
||||||
|
:::
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Install-Module oh-my-posh -Scope CurrentUser
|
||||||
|
```
|
||||||
|
|
||||||
|
:::caution
|
||||||
|
If you wish to install for **all users in a linux** environment, you will need to install from an **elevated PowerShell session**.
|
||||||
|
You will also need to import the module one time from the elevated session in order to set the executable permissions correctly.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
sudo pwsh
|
||||||
|
Install-Module oh-my-posh -Scope AllUsers
|
||||||
|
Import-Module oh-my-posh
|
||||||
|
```
|
||||||
|
:::
|
||||||
|
|
||||||
|
## List all themes
|
||||||
|
|
||||||
|
To display every available theme in the current directory, use the following
|
||||||
|
cmdlet.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Get-PoshThemes
|
||||||
|
```
|
||||||
|
|
||||||
|
## Replace your existing prompt
|
||||||
|
|
||||||
|
Edit `$PROFILE` in your preferred PowerShell version and add the following line. Autocompletion is available so it will loop
|
||||||
|
through all available themes.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Set-PoshPrompt -Theme jandedobbeleer
|
||||||
|
```
|
||||||
|
|
||||||
|
Once added, reload your profile for the changes to take effect.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
. $profile
|
||||||
|
```
|
||||||
|
|
||||||
|
<Customize />
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Export-PoshTheme -FilePath ~/.mytheme.omp.json -Format json
|
||||||
|
```
|
||||||
|
|
||||||
|
Once you're done editing, adjust your `$PROFILE` to use your newly created theme.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Set-PoshPrompt -Theme ~/.mytheme.omp.json
|
||||||
|
```
|
||||||
|
|
||||||
|
## Update
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Update-Module oh-my-posh
|
||||||
|
```
|
||||||
|
|
||||||
|
🎉🎉🎉
|
||||||
|
|
||||||
|
[scoop]: https://scoop.sh/
|
||||||
|
[wt]: https://github.com/microsoft/terminal
|
||||||
|
[powershell]: https://www.powershellgallery.com/packages/oh-my-posh
|
||||||
|
[configuration]: /docs/configure
|
105
docs/docs/install-shells.mdx
Normal file
105
docs/docs/install-shells.mdx
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
import Tabs from "@theme/Tabs";
|
||||||
|
import TabItem from "@theme/TabItem";
|
||||||
|
|
||||||
|
:::info
|
||||||
|
If you have no idea which shell you're currently using, Oh my Posh has a utility switch that can you tell you (not relevant
|
||||||
|
for the Powershell module).
|
||||||
|
:::
|
||||||
|
|
||||||
|
```bash
|
||||||
|
oh-my-posh --print-shell
|
||||||
|
```
|
||||||
|
|
||||||
|
<Tabs
|
||||||
|
defaultValue="powershell"
|
||||||
|
groupId="shell"
|
||||||
|
values={[
|
||||||
|
{ label: 'powershell', value: 'powershell', },
|
||||||
|
{ 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.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Invoke-Expression (oh-my-posh --init --shell pwsh --config ~/mytheme.omp.json)
|
||||||
|
```
|
||||||
|
|
||||||
|
Once added, reload your profile for the changes to take effect.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
. $profile
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="zsh">
|
||||||
|
|
||||||
|
Add the following to `~/.zshrc`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
eval "$(oh-my-posh --init --shell zsh --config ~/mytheme.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` (or `~/.profile` on MacOS):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
eval "$(oh-my-posh --init --shell bash --config ~/mytheme.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 ~/.poshthemes/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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
config set prompt "= `{{$(oh-my-posh --config ~/.poshthemes/jandedobbeleer.omp.json | str collect)}}`"
|
||||||
|
```
|
||||||
|
|
||||||
|
Restart nu shell for the changes to take effect.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</Tabs>
|
75
docs/docs/install-windows.mdx
Normal file
75
docs/docs/install-windows.mdx
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
---
|
||||||
|
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
|
||||||
|
|
||||||
|
```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.
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
#### Preview the themes
|
||||||
|
|
||||||
|
```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 ""
|
||||||
|
& "C:\tools\oh-my-posh.exe" -config $($_.FullName) -pwd $PWD
|
||||||
|
Write-Host ""
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Update
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
scoop update oh-my-posh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Replace your existing prompt
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
The guides below use an imaginary theme called `mytheme.omp.json`, so make sure to replace that with your own, or one of the
|
||||||
|
included themes.
|
||||||
|
|
||||||
|
<Shells />
|
||||||
|
|
||||||
|
### Customize
|
||||||
|
|
||||||
|
<Customize />
|
||||||
|
|
||||||
|
<CustomizeCmd />
|
||||||
|
|
||||||
|
🎉🎉🎉
|
||||||
|
|
||||||
|
[scoop]: https://scoop.sh/
|
||||||
|
[wt]: https://github.com/microsoft/terminal
|
||||||
|
[powershell]: https://www.powershellgallery.com/packages/oh-my-posh
|
|
@ -1,482 +0,0 @@
|
||||||
---
|
|
||||||
id: installation
|
|
||||||
title: Installation
|
|
||||||
sidebar_label: 🚀 Installation
|
|
||||||
---
|
|
||||||
|
|
||||||
import Tabs from "@theme/Tabs";
|
|
||||||
import TabItem from "@theme/TabItem";
|
|
||||||
|
|
||||||
### 1. Setup your terminal
|
|
||||||
|
|
||||||
<Tabs
|
|
||||||
defaultValue="windows"
|
|
||||||
groupId="env"
|
|
||||||
values={[
|
|
||||||
{ label: 'windows', value: 'windows', },
|
|
||||||
{ label: 'macOS', value: 'macos', },
|
|
||||||
{ label: 'unix', value: 'unix', },
|
|
||||||
]
|
|
||||||
}>
|
|
||||||
<TabItem value="windows">
|
|
||||||
|
|
||||||
#### Terminal
|
|
||||||
|
|
||||||
While Oh my Posh works on the standard terminal, we advise using the [Windows Terminal][wt].
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
<TabItem value="macos">
|
|
||||||
|
|
||||||
#### Terminal
|
|
||||||
|
|
||||||
As the standard terminal has issues displaying the ANSI characters correctly, we advise using
|
|
||||||
[iTerm2][iterm2] or any other modern day MacOS terminal that supports ANSI characters.
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
<TabItem value="unix">
|
|
||||||
|
|
||||||
#### Terminal
|
|
||||||
|
|
||||||
Oh my Posh uses ANSI color codes under the hood, these should work in every terminal,
|
|
||||||
but you may have to set the environment variable `$TERM` to `xterm-256color` for it to work.
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
</Tabs>
|
|
||||||
|
|
||||||
### 2. Install Oh my Posh
|
|
||||||
|
|
||||||
<Tabs
|
|
||||||
defaultValue="powershell"
|
|
||||||
groupId="env"
|
|
||||||
values={[
|
|
||||||
{ label: 'powershell', value: 'powershell', },
|
|
||||||
{ label: 'windows', value: 'windows', },
|
|
||||||
{ label: 'macOS', value: 'macos', },
|
|
||||||
{ label: 'unix', value: 'unix', },
|
|
||||||
]
|
|
||||||
}>
|
|
||||||
<TabItem value="powershell">
|
|
||||||
|
|
||||||
A [Powershell][powershell] module is available for easy installation.
|
|
||||||
|
|
||||||
#### Installation
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
Install-Module oh-my-posh -Scope CurrentUser -AllowPrerelease
|
|
||||||
```
|
|
||||||
|
|
||||||
If you wish to install for all users in a linux environment, you will need to install from an elevate session
|
|
||||||
of powershell. You will also need to import the module one time from the elevated session in order to set the
|
|
||||||
executable permissions correctly.
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
sudo pwsh
|
|
||||||
Install-Module oh-my-posh -Scope AllUsers -AllowPrerelease
|
|
||||||
Import-Module oh-my-posh
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Usage
|
|
||||||
|
|
||||||
##### Show all themes
|
|
||||||
|
|
||||||
To display every available theme in the current directory, use the following
|
|
||||||
cmdlet.
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
Get-PoshThemes
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
<TabItem value="windows">
|
|
||||||
|
|
||||||
A [Scoop][scoop] package is available for easy installation.
|
|
||||||
|
|
||||||
#### Installation
|
|
||||||
|
|
||||||
```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.
|
|
||||||
|
|
||||||
#### Preview the themes
|
|
||||||
|
|
||||||
```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 ""
|
|
||||||
& "C:\tools\oh-my-posh.exe" -config $($_.FullName) -pwd $PWD
|
|
||||||
Write-Host ""
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Update
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
scoop update oh-my-posh
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
<TabItem value="macos">
|
|
||||||
|
|
||||||
A [Homebrew][brew] formula is available for easy installation.
|
|
||||||
|
|
||||||
#### Installation
|
|
||||||
|
|
||||||
```bash
|
|
||||||
brew tap jandedobbeleer/oh-my-posh
|
|
||||||
brew install oh-my-posh
|
|
||||||
```
|
|
||||||
|
|
||||||
This installs two things:
|
|
||||||
|
|
||||||
- `oh-my-posh` - Executable, added to `/usr/local/bin`
|
|
||||||
- `themes` - The latest Oh my Posh themes
|
|
||||||
|
|
||||||
If you want to use a standard theme, you can find them in `$(brew --prefix oh-my-posh)/themes`, referencing them as such
|
|
||||||
will always keep them compatible with the binary when updating Oh my Posh.
|
|
||||||
|
|
||||||
#### Preview the themes
|
|
||||||
|
|
||||||
```bash
|
|
||||||
for file in $(brew --prefix oh-my-posh)/themes/*.omp.json; do echo "$file\n"; oh-my-posh --config $file --shell universal; echo "\n"; done;
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Update
|
|
||||||
|
|
||||||
```bash
|
|
||||||
brew upgrade oh-my-posh
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
<TabItem value="unix">
|
|
||||||
|
|
||||||
#### Installation
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
|
|
||||||
sudo chmod +x /usr/local/bin/oh-my-posh
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Download the themes
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mkdir ~/.poshthemes
|
|
||||||
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/themes.zip -O ~/.poshthemes/themes.zip
|
|
||||||
unzip ~/.poshthemes/themes.zip -d ~/.poshthemes
|
|
||||||
chmod u+rw ~/.poshthemes/*.json
|
|
||||||
rm ~/.poshthemes/themes.zip
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Preview the themes
|
|
||||||
|
|
||||||
```bash
|
|
||||||
for file in ~/.poshthemes/*.omp.json; do echo "$file\n"; oh-my-posh --config $file --shell universal; echo "\n"; done;
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
</Tabs>
|
|
||||||
|
|
||||||
### 3. Replace your existing prompt
|
|
||||||
|
|
||||||
:::info
|
|
||||||
If you have no idea which shell you're currently using, Oh my Posh has a utility switch that can you tell you (not relevant
|
|
||||||
for the Powershell module).
|
|
||||||
:::
|
|
||||||
|
|
||||||
```bash
|
|
||||||
oh-my-posh --print-shell
|
|
||||||
```
|
|
||||||
|
|
||||||
<Tabs
|
|
||||||
defaultValue="powershell"
|
|
||||||
groupId="env"
|
|
||||||
values={[
|
|
||||||
{ label: 'powershell', value: 'powershell', },
|
|
||||||
{ 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.
|
|
||||||
|
|
||||||
<Tabs
|
|
||||||
defaultValue="windows"
|
|
||||||
groupId="env"
|
|
||||||
values={[
|
|
||||||
{ label: 'module', value: 'powershell', },
|
|
||||||
{ label: 'macOS', value: 'macos', },
|
|
||||||
{ label: 'windows', value: 'windows', },
|
|
||||||
]
|
|
||||||
}>
|
|
||||||
<TabItem value="powershell">
|
|
||||||
|
|
||||||
Autocompletion is available so it will loop through all available themes.
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
Set-PoshPrompt -Theme jandedobbeleer
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
<TabItem value="macos">
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
Invoke-Expression (oh-my-posh --init --shell pwsh --config "$(brew --prefix oh-my-posh)/themes/jandedobbeleer.omp.json")
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
<TabItem value="windows">
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
Invoke-Expression (oh-my-posh --init --shell pwsh --config "$(scoop prefix oh-my-posh)/themes/jandedobbeleer.omp.json")
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
</Tabs>
|
|
||||||
|
|
||||||
Once added, reload your profile for the changes to take effect.
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
. $profile
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
<TabItem value="zsh">
|
|
||||||
|
|
||||||
Add the following to `~/.zshrc`:
|
|
||||||
|
|
||||||
<Tabs
|
|
||||||
defaultValue="macos"
|
|
||||||
groupId="env"
|
|
||||||
values={[
|
|
||||||
{ label: 'macOS', value: 'macos', },
|
|
||||||
{ label: 'unix', value: 'unix', },
|
|
||||||
]
|
|
||||||
}>
|
|
||||||
<TabItem value="macos">
|
|
||||||
|
|
||||||
```bash
|
|
||||||
eval "$(oh-my-posh --init --shell zsh --config $(brew --prefix oh-my-posh)/themes/jandedobbeleer.omp.json)"
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
<TabItem value="unix">
|
|
||||||
|
|
||||||
```bash
|
|
||||||
eval "$(oh-my-posh --init --shell zsh --config ~/.poshthemes/jandedobbeleer.omp.json)"
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
</Tabs>
|
|
||||||
|
|
||||||
Once added, reload your profile for the changes to take effect.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
source ~/.zshrc
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
<TabItem value="bash">
|
|
||||||
|
|
||||||
Add the following to `~/.bashrc` (or `~/.profile` on MacOS):
|
|
||||||
|
|
||||||
<Tabs
|
|
||||||
defaultValue="macos"
|
|
||||||
groupId="env"
|
|
||||||
values={[
|
|
||||||
{ label: 'macOS', value: 'macos', },
|
|
||||||
{ label: 'unix', value: 'unix', },
|
|
||||||
]
|
|
||||||
}>
|
|
||||||
<TabItem value="macos">
|
|
||||||
|
|
||||||
```bash
|
|
||||||
eval "$(oh-my-posh --init --shell bash --config $(brew --prefix oh-my-posh)/themes/jandedobbeleer.omp.json)"
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
<TabItem value="unix">
|
|
||||||
|
|
||||||
```bash
|
|
||||||
eval "$(oh-my-posh --init --shell bash --config ~/.poshthemes/jandedobbeleer.omp.json)"
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
</Tabs>
|
|
||||||
|
|
||||||
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 ~/.poshthemes/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:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
config set prompt "= `{{$(oh-my-posh --config ~/.poshthemes/jandedobbeleer.omp.json | str collect)}}`"
|
|
||||||
```
|
|
||||||
|
|
||||||
Restart nu shell for the changes to take effect.
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
</Tabs>
|
|
||||||
|
|
||||||
### 5. Next steps
|
|
||||||
|
|
||||||
At this point you're good to go. The `jandedobbeleer.omp.json` theme displays most common use-cases
|
|
||||||
in your prompt so 9/10 you'll be more than happy with it. However, if you want to explore additional
|
|
||||||
functionality, going through the additional steps below will help you get started.
|
|
||||||
|
|
||||||
#### Change the theme
|
|
||||||
|
|
||||||
We downloaded all the themes and set `jandedobbeleer.omp.json` as the one to use.
|
|
||||||
However, there are a lot more to be discovered and maybe there are some you like better.
|
|
||||||
|
|
||||||
Adjust your configuration to use any other theme from the folder we created (`~/.poshthemes`).
|
|
||||||
|
|
||||||
#### Override the theme settings
|
|
||||||
|
|
||||||
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 all
|
|
||||||
available options first, by starting with the [configuration guide][configuration].
|
|
||||||
|
|
||||||
<Tabs
|
|
||||||
defaultValue="powershell"
|
|
||||||
groupId="env"
|
|
||||||
values={[
|
|
||||||
{ label: 'powershell', value: 'powershell', },
|
|
||||||
{ label: 'zsh', value: 'zsh', },
|
|
||||||
{ label: 'bash', value: 'bash', },
|
|
||||||
{ label: 'fish', value: 'fish', },
|
|
||||||
]
|
|
||||||
}>
|
|
||||||
<TabItem value="powershell">
|
|
||||||
|
|
||||||
You can output the current theme to the format you like (`json`, `yaml` or `toml`) which can be used to tweak and store as your custom theme.
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
Export-PoshTheme -FilePath ~/.mytheme.omp.json -Format json
|
|
||||||
```
|
|
||||||
|
|
||||||
Once you're done editing, adjust your `$PROFILE` to use your newly created theme.
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
Set-PoshPrompt -Theme ~/.mytheme.omp.json
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
<TabItem value="zsh">
|
|
||||||
|
|
||||||
You can output the current theme to the format you like (`json`, `yaml` or `toml`) which can be used to tweak and store as your custom theme.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export_poshconfig "~/.mytheme.omp.json" json
|
|
||||||
```
|
|
||||||
|
|
||||||
Once you're done editing, adjust `~/.zshrc` to use your newly created theme.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
eval "$(oh-my-posh --init --shell zsh --config ~/.mytheme.omp.json)"
|
|
||||||
```
|
|
||||||
|
|
||||||
When adjusted, reload your profile for the changes to take effect.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
. ~/.zshrc
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
<TabItem value="bash">
|
|
||||||
|
|
||||||
You can output the current theme to the format you like (`json`, `yaml` or `toml`) which can be used to tweak and store as your custom theme.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export_poshconfig "~/.mytheme.omp.json" json
|
|
||||||
```
|
|
||||||
|
|
||||||
Once you're done editing, adjust `~/.bashrc` to use your newly created theme.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
eval "$(oh-my-posh --init --shell bash --config ~/.mytheme.omp.json)"
|
|
||||||
```
|
|
||||||
|
|
||||||
When adjusted, reload your profile for the changes to take effect.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
. ~/.bashrc
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
<TabItem value="fish">
|
|
||||||
|
|
||||||
You can output the current theme to the format you like (`json`, `yaml` or `toml`) which can be used to tweak and store as your custom theme.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export_poshconfig "~/.mytheme.omp.json" json
|
|
||||||
```
|
|
||||||
|
|
||||||
Once you're done editing, adjust `config.fish` to use your newly created theme.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
oh-my-posh --init --shell fish --config ~/.mytheme.omp.json | source
|
|
||||||
```
|
|
||||||
|
|
||||||
Once adjusted, reload your config for the changes to take effect.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
. ~/.config/fish/config.fish
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
</Tabs>
|
|
||||||
|
|
||||||
🎉🎉🎉
|
|
||||||
|
|
||||||
[scoop]: https://scoop.sh/
|
|
||||||
[wt]: https://github.com/microsoft/terminal
|
|
||||||
[iterm2]: https://www.iterm2.com/
|
|
||||||
[powershell]: https://www.powershellgallery.com/packages/oh-my-posh
|
|
||||||
[brew]: https://brew.sh
|
|
||||||
[prompt]: /docs/installation#3-replace-your-existing-prompt
|
|
||||||
[configuration]: /docs/configure
|
|
|
@ -3,7 +3,24 @@ module.exports = {
|
||||||
{
|
{
|
||||||
type: "category",
|
type: "category",
|
||||||
label: "Getting Started",
|
label: "Getting Started",
|
||||||
items: ["introduction", "upgrading", "installation", "configure", "themes", "share", "fonts"],
|
items: [
|
||||||
|
"introduction",
|
||||||
|
"upgrading",
|
||||||
|
{
|
||||||
|
type: "category",
|
||||||
|
label: "🚀 Installation",
|
||||||
|
items: [
|
||||||
|
"pwsh",
|
||||||
|
"windows",
|
||||||
|
"macos",
|
||||||
|
"linux",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"configure",
|
||||||
|
"themes",
|
||||||
|
"share",
|
||||||
|
"fonts"
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "category",
|
type: "category",
|
||||||
|
|
Loading…
Reference in a new issue