Closed ariscript closed 2 years ago
@dheerajpv try setting it to a boolean instead of a string:
"home_enabled": false,
That didn't fix it. It still does the same thing.
@dheerajpv works on my machine is zsh, how do you init oh-my-posh?
I followed the docs and added eval "$(oh-my-posh --init --shell zsh --config ~/.poshtheme.omp.json)"
to my .zshrc
.
@dheerajpv we actually do the following to get the home folder:
home := os.Getenv("HOME")
if len(home) > 0 {
return home
}
This should return the right path, just like in your screenshot. That would imply the we do not get the right path back (or in the same format) when calling getcwd
. Try the following in your shell BUT that could break other things as git bash is simply a disaster to work with:
eval "$(oh-my-posh --init --shell zsh --config ~/.poshtheme.oh-my-posh.json --pwd=$PWD)"
Still didn't seem to fix the issue. It's doing the same thing as before.
Probably should've mentioned this before, but whatever you were doing in v2 for this seemed to work perfectly well on git bash.
V2 didn't work in git bash so that can't be true 😁 we did changes to transform the path to the right in underneath git bash because of other reasons which might (once again) introduce other issues. I'll log the result as well so we can see what's going on.
@dheerajpv the latest release added additional debug information for these parts specifically.
This is what the latest release logs when I debug:
Version: 7.5.1
Segments:
ConsoleTitle(true) - 0 ms -
session(true) - 0 ms - %{%} %{%}%{%}dheer%{%}%{%} on%{%}
os(true) - 0 ms - %{%} %{%}%{%}%{%}%{%} %{%}
path(true) - 0 ms - %{%} %{%}%{%}%{%}~%{%}%{%}%{%} %{%}
git(false) - 0 ms -
node(false) - 0 ms -
python(false) - 0 ms -
dotnet(false) - 0 ms -
executiontime(false) - 0 ms -
time(true) - 0 ms - %{%} %{%}%{%}15:42:53%{%}%{%} %{%}
exit(true) - 0 ms - %{%}#%{%}%{%} %{%}
Run duration: 1.5907ms
Cache path: C:\Users\dheer\AppData\Local/oh-my-posh
Logs:
2022/01/20 15:42:53 getArgs duration: 0s, args:
2022/01/20 15:42:53 getArgs duration: 0s, args:
2022/01/20 15:42:53 getShellName duration: 0s, args:
2022/01/20 15:42:53 debug: getenv
2022/01/20 15:42:53 getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/01/20 15:42:53 isRunningAsRoot duration: 0s, args:
2022/01/20 15:42:53 getShellName duration: 0s, args:
2022/01/20 15:42:53 lastErrorCode duration: 0s, args:
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 536µs, args:
2022/01/20 15:42:53 debug: homeDir
C:\Users\dheer
2022/01/20 15:42:53 getPathSeperator duration: 0s, args:
2022/01/20 15:42:53 getPathSeperator duration: 0s, args:
2022/01/20 15:42:53 getCurrentUser duration: 0s, args:
2022/01/20 15:42:53 getHostName duration: 0s, args:
2022/01/20 15:42:53 getRuntimeGOOS duration: 0s, args:
2022/01/20 15:42:53 templateCache duration: 536µs, args:
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 0s, args:
2022/01/20 15:42:53 debug: homeDir
C:\Users\dheer
2022/01/20 15:42:53 debug: getenv
2022/01/20 15:42:53 getenv duration: 0s, args: SSH_CONNECTION
2022/01/20 15:42:53 debug: getenv
2022/01/20 15:42:53 getenv duration: 0s, args: SSH_CLIENT
2022/01/20 15:42:53 getCurrentUser duration: 0s, args:
2022/01/20 15:42:53 getRuntimeGOOS duration: 0s, args:
2022/01/20 15:42:53 debug: getenv
2022/01/20 15:42:53 getenv duration: 0s, args: POSH_SESSION_DEFAULT_USER
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 0s, args:
2022/01/20 15:42:53 debug: homeDir
C:\Users\dheer
2022/01/20 15:42:53 getRuntimeGOOS duration: 0s, args:
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 0s, args:
2022/01/20 15:42:53 debug: homeDir
C:\Users\dheer
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 0s, args:
2022/01/20 15:42:53 getArgs duration: 0s, args:
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 0s, args:
2022/01/20 15:42:53 debug: homeDir
C:\Users\dheer
2022/01/20 15:42:53 getRuntimeGOOS duration: 0s, args:
2022/01/20 15:42:53 getRuntimeGOOS duration: 0s, args:
2022/01/20 15:42:53 getPathSeperator duration: 0s, args:
2022/01/20 15:42:53 getArgs duration: 0s, args:
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 0s, args:
2022/01/20 15:42:53 debug: homeDir
C:\Users\dheer
2022/01/20 15:42:53 getRuntimeGOOS duration: 0s, args:
2022/01/20 15:42:53 getRuntimeGOOS duration: 0s, args:
2022/01/20 15:42:53 getPathSeperator duration: 0s, args:
2022/01/20 15:42:53 getRuntimeGOOS duration: 0s, args:
2022/01/20 15:42:53 isWsl duration: 0s, args:
2022/01/20 15:42:53 stackCount duration: 0s, args:
2022/01/20 15:42:53 templateCache duration: 0s, args:
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 0s, args:
2022/01/20 15:42:53 debug: homeDir
C:\Users\dheer
2022/01/20 15:42:53 getRuntimeGOOS duration: 0s, args:
2022/01/20 15:42:53 hasCommand duration: 529.6µs, args: git.exe
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 0s, args:
2022/01/20 15:42:53 error: hasParentFilePath
CreateFile C:\.git: The system cannot find the file specified.
2022/01/20 15:42:53 hasParentFilePath duration: 0s, args: .git
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 0s, args:
2022/01/20 15:42:53 debug: homeDir
C:\Users\dheer
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 0s, args:
2022/01/20 15:42:53 debug: homeDir
C:\Users\dheer
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 0s, args:
2022/01/20 15:42:53 debug: homeDir
C:\Users\dheer
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 0s, args:
2022/01/20 15:42:53 debug: homeDir
C:\Users\dheer
2022/01/20 15:42:53 debug: getenv
2022/01/20 15:42:53 getenv duration: 0s, args: VIRTUAL_ENV
2022/01/20 15:42:53 debug: getenv
2022/01/20 15:42:53 getenv duration: 0s, args: CONDA_ENV_PATH
2022/01/20 15:42:53 debug: getenv
2022/01/20 15:42:53 getenv duration: 0s, args: CONDA_DEFAULT_ENV
2022/01/20 15:42:53 debug: getenv
2022/01/20 15:42:53 getenv duration: 0s, args: PYENV_VERSION
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 0s, args:
2022/01/20 15:42:53 debug: homeDir
C:\Users\dheer
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 0s, args:
2022/01/20 15:42:53 debug: homeDir
C:\Users\dheer
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 0s, args:
2022/01/20 15:42:53 debug: homeDir
C:\Users\dheer
2022/01/20 15:42:53 executionTime duration: 0s, args:
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 0s, args:
2022/01/20 15:42:53 debug: homeDir
C:\Users\dheer
2022/01/20 15:42:53 debug: pwd
C:\Users\dheer
2022/01/20 15:42:53 pwd duration: 0s, args:
2022/01/20 15:42:53 debug: homeDir
C:\Users\dheer
2022/01/20 15:42:53 lastErrorCode duration: 0s, args:
2022/01/20 15:42:53 debug: getenv
C:\Users\dheer\AppData\Local
2022/01/20 15:42:53 getenv duration: 0s, args: LOCALAPPDATA
2022/01/20 15:42:53 getCachePath duration: 0s, args:
Now it gets really interesting. I'll have a look tomorrow.
@dheerajpv but wait, node is disabled here. That's what you expect, right?
It says that node is disabled, but it does still appear in my prompt (not any of the others though for some reason).
Now that I look at it, it also shows that node is disabled in the first comment too...
@dheerajpv are you certain the config file you use on debug is identical to the one you use for initialization?
Yes, I'm using the same config for both cases:
Also, it works as intended in powershell so it shouldn't be a configuration issue.
Any update on this?
@dheerajpv didn't find time yet.
I just spent the past hour installing and configuring a setup which is identical to yours and I can't reproduce this at all. Both git bash and zsh work as expected, it also doesn't make sense that you can see it in you prompt but debug says otherwise (that's technically NOT possible without a different config or oh-my-posh version for prompt/debug).
BTW, I really urge you to use a different shell. This is by far the worst experience I've ever seen. That zsh shell has all sorts of quirks.
Found a way to reproduce it! Now let's see if we can fix it :-)
works now, thanks!
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.
Code of Conduct
What happened?
First off, I should probably say that this shell is not really normal. I'm running Git Bash with zsh (and oh-my-zsh) installed, with oh-my-posh to use the same prompt across shells and WSL with the same config file.
Setting
home_enabled
to false in my configuration is not removing my node version from my prompt when in my home directory. This same config works fine on PowerShell however (did not test on cmd).The node section of my config looks like this:
Theme
You can see my full config here: https://gist.github.com/dheerajpv/a8c471021e975c59f906b936b9063438
What OS are you seeing the problem on?
Windows
Which shell are you using?
zsh
Log output