diff --git a/docs/docs/install-customize-cmd.mdx b/docs/docs/install-customize-cmd.mdx new file mode 100644 index 00000000..90013154 --- /dev/null +++ b/docs/docs/install-customize-cmd.mdx @@ -0,0 +1,85 @@ +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + + + + +```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) +``` + + + + +```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 +``` + + + + +```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 +``` + + + + +```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 +``` + + + diff --git a/docs/docs/install-customize.md b/docs/docs/install-customize.md new file mode 100644 index 00000000..40925263 --- /dev/null +++ b/docs/docs/install-customize.md @@ -0,0 +1,21 @@ + +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 diff --git a/docs/docs/install-linux.mdx b/docs/docs/install-linux.mdx new file mode 100644 index 00000000..f9533b2a --- /dev/null +++ b/docs/docs/install-linux.mdx @@ -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 + + + +### Customize + + + + + +🎉🎉🎉 + +[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 diff --git a/docs/docs/install-macos.mdx b/docs/docs/install-macos.mdx new file mode 100644 index 00000000..be20acf5 --- /dev/null +++ b/docs/docs/install-macos.mdx @@ -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 + + + +### Customize + + + + + +🎉🎉🎉 + +[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 diff --git a/docs/docs/install-pwsh.mdx b/docs/docs/install-pwsh.mdx new file mode 100644 index 00000000..8636e82f --- /dev/null +++ b/docs/docs/install-pwsh.mdx @@ -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 +``` + + + +```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 diff --git a/docs/docs/install-shells.mdx b/docs/docs/install-shells.mdx new file mode 100644 index 00000000..d9d55d0a --- /dev/null +++ b/docs/docs/install-shells.mdx @@ -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 +``` + + + + +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 +``` + + + + +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 +``` + + + + +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 +``` + + + + +:::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 +``` + + + + +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. + + + diff --git a/docs/docs/install-windows.mdx b/docs/docs/install-windows.mdx new file mode 100644 index 00000000..ea503808 --- /dev/null +++ b/docs/docs/install-windows.mdx @@ -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. + + + +### Customize + + + + + +🎉🎉🎉 + +[scoop]: https://scoop.sh/ +[wt]: https://github.com/microsoft/terminal +[powershell]: https://www.powershellgallery.com/packages/oh-my-posh diff --git a/docs/docs/installation.mdx b/docs/docs/installation.mdx deleted file mode 100644 index 6d11f2d7..00000000 --- a/docs/docs/installation.mdx +++ /dev/null @@ -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 - - - - -#### Terminal - -While Oh my Posh works on the standard terminal, we advise using the [Windows Terminal][wt]. - - - - -#### 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. - - - - -#### 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. - - - - -### 2. Install Oh my Posh - - - - -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 -``` - - - - -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 -``` - - - - -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 -``` - - - - -#### 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; -``` - - - - -### 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 -``` - - - - -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 -``` - - - - -```powershell -Invoke-Expression (oh-my-posh --init --shell pwsh --config "$(brew --prefix oh-my-posh)/themes/jandedobbeleer.omp.json") -``` - - - - -```powershell -Invoke-Expression (oh-my-posh --init --shell pwsh --config "$(scoop prefix oh-my-posh)/themes/jandedobbeleer.omp.json") -``` - - - - -Once added, reload your profile for the changes to take effect. - -```powershell -. $profile -``` - - - - -Add the following to `~/.zshrc`: - - - - -```bash -eval "$(oh-my-posh --init --shell zsh --config $(brew --prefix oh-my-posh)/themes/jandedobbeleer.omp.json)" -``` - - - - -```bash -eval "$(oh-my-posh --init --shell zsh --config ~/.poshthemes/jandedobbeleer.omp.json)" -``` - - - - -Once added, reload your profile for the changes to take effect. - -```bash -source ~/.zshrc -``` - - - - -Add the following to `~/.bashrc` (or `~/.profile` on MacOS): - - - - -```bash -eval "$(oh-my-posh --init --shell bash --config $(brew --prefix oh-my-posh)/themes/jandedobbeleer.omp.json)" -``` - - - - -```bash -eval "$(oh-my-posh --init --shell bash --config ~/.poshthemes/jandedobbeleer.omp.json)" -``` - - - - -Once added, reload your profile for the changes to take effect. - -```bash -. ~/.bashrc -``` - -Or, when using `~/.profile`. - -```bash -. ~/.profile -``` - - - - -:::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 -``` - - - - -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. - - - - -### 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]. - - - - -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 -``` - - - - -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 -``` - - - - -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 -``` - - - - -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 -``` - - - - -🎉🎉🎉 - -[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 diff --git a/docs/sidebars.js b/docs/sidebars.js index 689bca29..6ab7598b 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -3,7 +3,24 @@ module.exports = { { type: "category", 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",