|
| 1 | +--- |
| 2 | +id: upgrading |
| 3 | +title: Upgrading |
| 4 | +sidebar_label: Upgrading from V2 |
| 5 | +--- |
| 6 | + |
| 7 | +Just like V2, V3 is available in the [PowerShell gallery][psgallery]. Due to its nature, it's only |
| 8 | +available as a prerelease while we work out the kinks and get it on par with V2. |
| 9 | + |
| 10 | +## V2's problem statement |
| 11 | + |
| 12 | +V2 has Powershell module files as [themes][themesv2]. That way of working was inspired from [oh-my-zsh][omz] and other |
| 13 | +prompt rendering tools, but that approach has a few important downsides. |
| 14 | + |
| 15 | +- hard to extend/adjust when you're not proficient |
| 16 | +- the need to expose a lot of functions/settings to allow ease of personalization |
| 17 | +- limited to Powershell |
| 18 | + |
| 19 | +## Enter V3 |
| 20 | + |
| 21 | +This bring us to the first change, to allow a cross platform experience, [Oh My Posh V3][v3] is written entirely in [Go][golang]. |
| 22 | +That way, cross platform binaries can be shipped which render the same prompt using the same config anywhere. |
| 23 | + |
| 24 | +The configuration is changed from `$ThemeSettings` towards a `.json` file that only contains the configuration for the |
| 25 | +blocks and segments you want to render. See [concept][introduction] for more context on that part. |
| 26 | + |
| 27 | +Let's have a look at the V2 commands and how to move towards V3. |
| 28 | + |
| 29 | +## Import |
| 30 | + |
| 31 | +Stays the same! Alright. All you need to do is update to the **beta**. |
| 32 | + |
| 33 | +```powershell |
| 34 | +Update-Module -Name oh-my-posh -AllowPrerelease -Scope CurrentUser |
| 35 | +``` |
| 36 | + |
| 37 | +## Configuration |
| 38 | + |
| 39 | +Here we have a few options. If you're using an out-of-the box theme, you can simply change the current command to the |
| 40 | +new one, provided your V2 theme has already been added to [V3][themesv3]. |
| 41 | + |
| 42 | +### I use an out-of-the-box theme |
| 43 | + |
| 44 | +Change the current prompt setting function to the new one. |
| 45 | + |
| 46 | +```powershell |
| 47 | +# Set-Theme Agnoster |
| 48 | +Set-PoshPrompt -Theme agnoster |
| 49 | +``` |
| 50 | + |
| 51 | +### I use a custom theme/settings |
| 52 | + |
| 53 | +The first thing to do is to look for the theme you based your theme on. |
| 54 | +If you don't remember which one, preview them all and take the one closest to yours. |
| 55 | + |
| 56 | +```powershell |
| 57 | +Get-PoshThemes |
| 58 | +``` |
| 59 | + |
| 60 | +If you see one you like, set it, export its config so you can customize/extend the blocks ans segmnts. |
| 61 | + |
| 62 | +```powershell |
| 63 | +Set-PoshPrompt -Theme jandedobbeleer |
| 64 | +Write-PoshTheme | Out-File -FilePath ~/.go-my-posh.json |
| 65 | +``` |
| 66 | + |
| 67 | +Adjust the config (`~/.go-my-posh.json`) to your liking by going through the [configuration][configuration] guide. |
| 68 | +Set your custom theme and enjoy. |
| 69 | + |
| 70 | +```powershell |
| 71 | +Set-PoshPrompt -Theme ~/.go-my-posh.json |
| 72 | +``` |
| 73 | + |
| 74 | +### I have no idea just yet |
| 75 | + |
| 76 | +Great! There's an option for that too. You can easily list all available themes and pick the one you like best. |
| 77 | + |
| 78 | +```powershell |
| 79 | +Get-PoshThemes |
| 80 | +``` |
| 81 | + |
| 82 | +Choose and set the one you like. |
| 83 | + |
| 84 | +```powershell |
| 85 | +Set-PoshPrompt -Theme jandedobbeleer |
| 86 | +``` |
| 87 | + |
| 88 | +## All set, now what |
| 89 | + |
| 90 | +You can either tweak the theme to your liking, add segments or [submit an issue][issues] for new functionality. |
| 91 | +Do not hesitate to [ask for assistance][issues] when you notice an issue or unexpected behavior. |
| 92 | + |
| 93 | +[psgallery]: https://www.powershellgallery.com/packages/oh-my-posh |
| 94 | +[themesv2]: https://github.com/JanDeDobbeleer/oh-my-posh/tree/master/Themes |
| 95 | +[omz]: https://github.com/ohmyzsh/ohmyzsh |
| 96 | +[golang]: https://golang.org/ |
| 97 | +[introduction]: /docs/#concept |
| 98 | +[v3]: https://github.com/JanDeDobbeleer/oh-my-posh3/ |
| 99 | +[themesv3]: https://github.com/JanDeDobbeleer/oh-my-posh3/tree/main/themes |
| 100 | +[configuration]: /docs/configure |
| 101 | +[issues]: https://github.com/JanDeDobbeleer/oh-my-posh3/issues/new |
0 commit comments