Direct naar hoofdinhoud

Aanpassen

Onofficiële Beta-vertaling

Deze pagina is vertaald door PageTurner AI (beta). Niet officieel goedgekeurd door het project. Een fout gevonden? Probleem melden →

De standaard initialisatie gebruikt Oh My Posh' standaard ingebouwde thema.

Om een nieuwe configuratie of thema in te stellen, moet je de --config optie in de oh-my-posh init <shell> regel aanpassen in je profile of .<shell>rc script (zie prompt).

De --config vlag accepteert drie soorten waarden:

  • een pad naar een lokaal configuratiebestand

    --config 'C:/Users/Posh/myconfig.omp.json'
  • een themanaam zonder extensie

    --config 'jandedobbeleer'
  • een URL naar een externe configuratie

    --config 'https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/jandedobbeleer.omp.json'
informatie

Het gebruik van een themanaam (zoals jandedobbeleer) of een externe URL vereist een actieve internetverbinding en downloadt de configuratie bij het starten van de shell. Caching is ingeschakeld, maar voor betere prestaties wordt een lokaal configuratiebestand aanbevolen.

Configuratie instellen

Het onderstaande voorbeeld gebruikt een lokaal pad naar het jandedobbeleer thema. Pas de --config waarde aan om je eigen configuratiebestand te gebruiken, lokaal of extern.

Adjust the Oh My Posh init line in your $PROFILE by adding the --config flag with the location of your configuration.

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

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

. $PROFILE
informatie

When the above command gives an error, make sure to create the profile first and add the oh-my-posh init above.

New-Item -Path $PROFILE -Type File -Force

In this scenario, it can also be that PowerShell blocks running local scripts. To solve that, set PowerShell to only require remote scripts to be signed using Set-ExecutionPolicy RemoteSigned, or [sign the profile][sign].

wsl

Bij gebruik van Oh My Posh in Windows en WSL kun je je thema delen met WSL door te verwijzen naar een thema in je Windows gebruikersmap.

In WSL vind je de Windows gebruikersmap hier: /mnt/c/Users/<WINDOWSUSERNAME>.

Aangepaste configuratie

Wellicht vind je een thema mooi, maar bevalt het kleurenschema niet. Of misschien wil je een segment aanpassen/toevoegen, of iconen vervangen. Bekijk eerst de beschikbare opties via de configuratie.

Je kunt het huidige thema (standaard of ingesteld via --config) exporteren naar een gewenst formaat (json, yaml of toml) om aan te passen en op te slaan als eigen configuratie.

oh-my-posh config export --config jandedobbeleer --output ~/.mytheme.omp.json

Live herladen

Standaard wordt de configuratie gecached voor betere prestaties. Na wijzigingen in je configuratiebestand kun je deze direct in je prompt zien zonder je shell te herstarten met deze opdracht:

oh-my-posh enable reload

Schakel live herladen uit met:

oh-my-posh disable reload

Wijzigingen vooraf bekijken

Bekijk je aanpassingen vooraf door elke geconfigureerde prompt te renderen met:

oh-my-posh print preview

Gebruik de --force vlag om alle segmenten te renderen, ongeacht de huidige context.

oh-my-posh print preview --force

Lees de documentatie

Lees de configuratie- en segmentensecties om thema's volledig te begrijpen. De configuratie behandelt de basisbouwstenen en concepten, terwijl de segmentensectie de configuratie van elk beschikbaar segment uitlegt.