Closed BeachGuyCasey38 closed 1 day ago
This is my custom profile:
$Hour = (Get-Date).Hour
If ($Hour -lt 12) {"Good Morning Casey"}
ElseIf ($Hour -gt 17) {"Good Eventing Casey"}
Else {"Good Afternoon Casey"}
#Install and Import Terminal-Icons
Install-Module -Name Terminal-Icons -Repository PSGallery
Import-Module -Name Terminal-Icons
# Style default PowerShell Console
$shell = $Host.UI.RawUI
$shell.WindowTitle= "PowerShell 7.4.2"
$shell.BackgroundColor = "Black"
$shell.ForegroundColor = "White"
# Load custom theme for Windows Terminal
#Set Prompt
oh-my-posh init pwsh --config 'https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/xtoys.omp.json'
###################################################################################
# Import the Chocolatey Profile that contains the necessary code to enable
# tab-completions to function for `choco`.
# Be aware that if you are missing these lines from your profile, tab completion
# for `choco` will not function.
# See https://ch0.co/tab-completion for details.
####################################################################################
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
# Enhanced PowerShell Experience
Set-PSReadLineOption -Colors @{
Command = 'Yellow'
Parameter = 'Green'
String = 'DarkCyan'
}
### Quality of Life Aliases
# Navigation Shortcuts
function docs { Set-Location -Path $HOME\Documents }
function dtop { Set-Location -Path $HOME\Desktop }
function downloads { Set-Location -Path $HOME\Downloads}
function Dropbox {Set-Location -Path $HOME\Dropbox}
function D {Set-Location -Path D:\}
Set-Alias -Name np+ -Value 'C:\Program Files\Notepad++/Notepad++.exe'
# Quick Access to System Information
function sysinfo { Get-ComputerInfo }
# Networking Utilities
function flushdns { Clear-DnsClientCache }
# Clipboard Utilities
function cpy { Set-Clipboard $args[0] }
function pst { Get-Clipboard }
#View History
Function Get-History-Full {Get-Content (Get-PSReadlineOption).HistorySavePath}
Set-Alias -name hist -value get-history-full -Option AllScope
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine -MinimumVersion 2.2.6
}
# Set PSReadline Functions
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -EditMode Windows```
@beachguycasey31 you forgot to add Invoke-Expression
to the oh-my-posh init command:
oh-my-posh init pwsh --config 'https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/xtoys.omp.json' | Invoke-Expression
Code of Conduct
What happened?
When I launch PowerShell and it tries to load my profile I get this error: : "(@(& 'C:/Users/casey/AppData/Local/Programs/oh-my-posh/bin/oh-my-posh.exe' init pwsh --config='C:\Users\casey\AppData\Local\oh-my-posh\config.cf0d27a6c7e93ca744a56efcd8cc1365fd442067ee09a7a2617e5c064ed79cf3.omp.json' --print) -join "`n") | Invoke-ExpressionLoading personal and system profiles took 9646ms."
Theme
I'm using this theme: xtoys and using a custom profile.
What OS are you seeing the problem on?
Windows
Which shell are you using?
powershell
Log output