JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
16.79k stars 2.35k forks source link

Unable to install on Powershell Preview 7.3.0 #1525

Closed sguergachi closed 2 years ago

sguergachi commented 2 years ago

Code of Conduct

What happened?

I followed the install instructions here: https://ohmyposh.dev/docs/windows

For context I am using Windows Terminal 1.12.3472.0 with PowerShell 7.3.0-preview 1 as my setup. I installed Oh My Posh using winget.

For "Replace your existing prompt" I ran the following command: oh-my-posh --init --shell pwsh --config ~/atomic.omp.json | Invoke-Expression I have atomic.omp.json in $HOME

When I ran . $PROFILE the following error is returned:

.: The term 'C:\Users\Sammy\Documents\PowerShell\Microsoft.PowerShell_profile.ps1' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Theme

atomic

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

Version: 6.42.4

Segments:

ConsoleTitle(true) -   0 ms -
session(true)  -   0 ms -  Sammy@Sammy 
path(true)     -   0 ms -   ~ 
git(false)     -  10 ms -
battery(false) -   2 ms -
node(false)    -   0 ms -
shell(true)    -   0 ms -  ﲵ uni 
root(false)    -   0 ms -
text(true)     -   0 ms -  NO CONFIG 
exit(true)     -   0 ms -   

Run duration: 13.844ms

Logs:

2022/01/01 01:19:35 debug: getenv
C:\Users\Sammy\AppData\Local
2022/01/01 01:19:35 getenv duration: 0s, args: LOCALAPPDATA
2022/01/01 01:19:35 getCachePath duration: 0s, args:
2022/01/01 01:19:35 getArgs duration: 0s, args:
2022/01/01 01:19:35 getArgs duration: 0s, args:
2022/01/01 01:19:35 getShellName duration: 0s, args:
2022/01/01 01:19:35 debug: getenv

2022/01/01 01:19:35 getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/01/01 01:19:35 isRunningAsRoot duration: 0s, args:
2022/01/01 01:19:35 getcwd duration: 0s, args:
2022/01/01 01:19:35 getPathSeperator duration: 0s, args:
2022/01/01 01:19:35 getPathSeperator duration: 0s, args:
2022/01/01 01:19:35 getShellName duration: 0s, args:
2022/01/01 01:19:35 getCurrentUser duration: 0s, args:
2022/01/01 01:19:35 getHostName duration: 0s, args:
2022/01/01 01:19:35 getcwd duration: 0s, args:
2022/01/01 01:19:35 debug: getenv

2022/01/01 01:19:35 getenv duration: 0s, args: SSH_CONNECTION
2022/01/01 01:19:35 debug: getenv

2022/01/01 01:19:35 getenv duration: 0s, args: SSH_CLIENT
2022/01/01 01:19:35 getCurrentUser duration: 0s, args:
2022/01/01 01:19:35 getRuntimeGOOS duration: 0s, args:
2022/01/01 01:19:35 getHostName duration: 0s, args:
2022/01/01 01:19:35 debug: getenv

2022/01/01 01:19:35 getenv duration: 0s, args: POSH_SESSION_DEFAULT_USER
2022/01/01 01:19:35 getcwd duration: 0s, args:
2022/01/01 01:19:35 getcwd duration: 0s, args:
2022/01/01 01:19:35 getArgs duration: 0s, args:
2022/01/01 01:19:35 getcwd duration: 0s, args:
2022/01/01 01:19:35 getRuntimeGOOS duration: 0s, args:
2022/01/01 01:19:35 getRuntimeGOOS duration: 0s, args:
2022/01/01 01:19:35 getPathSeperator duration: 0s, args:
2022/01/01 01:19:35 getPathSeperator duration: 0s, args:
2022/01/01 01:19:35 getPathSeperator duration: 0s, args:
2022/01/01 01:19:35 getRuntimeGOOS duration: 0s, args:
2022/01/01 01:19:35 stackCount duration: 0s, args:
2022/01/01 01:19:35 getcwd duration: 0s, args:
2022/01/01 01:19:35 getRuntimeGOOS duration: 0s, args:
2022/01/01 01:19:35 hasCommand duration: 10.6032ms, args: git.exe
2022/01/01 01:19:35 getcwd duration: 0s, args:
2022/01/01 01:19:35 error: hasParentFilePath
CreateFile C:\.git: The system cannot find the file specified.
2022/01/01 01:19:35 hasParentFilePath duration: 0s, args: .git
2022/01/01 01:19:35 getcwd duration: 0s, args:
2022/01/01 01:19:35 getBatteryInfo duration: 2.0869ms, args:
2022/01/01 01:19:35 getcwd duration: 0s, args:
2022/01/01 01:19:35 getcwd duration: 0s, args:
2022/01/01 01:19:35 getcwd duration: 0s, args:
2022/01/01 01:19:35 getShellName duration: 0s, args:
2022/01/01 01:19:35 getcwd duration: 0s, args:
2022/01/01 01:19:35 isRunningAsRoot duration: 0s, args:
2022/01/01 01:19:35 getcwd duration: 0s, args:
2022/01/01 01:19:35 isRunningAsRoot duration: 0s, args:
2022/01/01 01:19:35 getcwd duration: 0s, args:
2022/01/01 01:19:35 getPathSeperator duration: 0s, args:
2022/01/01 01:19:35 getPathSeperator duration: 0s, args:
2022/01/01 01:19:35 getShellName duration: 0s, args:
2022/01/01 01:19:35 getCurrentUser duration: 0s, args:
2022/01/01 01:19:35 getHostName duration: 0s, args:
2022/01/01 01:19:35 getcwd duration: 0s, args:
2022/01/01 01:19:35 lastErrorCode duration: 0s, args:
JanDeDobbeleer commented 2 years ago

@sguergachi I believe you edited the wrong profile as the error states the file (C:\Users\Sammy\Documents\PowerShell\Microsoft.PowerShell_profile.ps1) doesn’t exist. Create the profile first, the try again.

sguergachi commented 2 years ago

hmm ok that fixes the error, but it doesn't seem to fix the issue of installing the prompt. I'm probably missing something simple.

The Profile file is created but after running the command oh-my-posh --init --shell pwsh --config ~/atomic.omp.json | Invoke-Expression the $PROFILE file remains empty - and opening a new terminal doesnt show the Oh My Posh prompt.

JanDeDobbeleer commented 2 years ago

@sguergachi you have to add that line to the profile. That way it runs automatically every time you open Powershell.

sguergachi commented 2 years ago

Oh, I'm a complete idiot, I thought running the line in the shell would automatically add it to the profile.

Missed this instruction:

Edit $PROFILE in your preferred PowerShell version and add the following line.

That works, thanks!

github-actions[bot] commented 6 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.