Closed mdnava closed 2 years ago
@mdnava that's a weird place for a nil pointer dereference
. Can you share your theme? It tries to replaces some string values, which fails, but that should be possible. I need some more insights into what could go wrong here as I don't immediately see it.
@mdnava found a potential cause. Will push a fix later today.
This is my config file in case it's of any use:
Note: I still have pending to read the newer documentation and remove those "type": "text" from segments. But since it's been working fine I've taken my time, but it's in my ToDo list..
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"version": 1,
"blocks": [
// =====================
// Prompt: First Line
// =====================
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "text",
"style": "plain",
"properties": {
"template": "{{if .Env.PROMPT_PRE_LNBR}}\n{{end}}"
}
},
{
"type": "text",
"style": "plain",
"background": "#FF00FF",
"foreground": "#ffffff",
"properties": {
"template": " {{if .Env.WSYSTEM}}{{.Env.WSYSTEM}}{{end}}{{if .Env.MSYSTEM}}{{.Env.MSYSTEM}}{{end}}{{if .Root}}\uf997{{end}}{{if not .Root}} {{end}}"
}
},
{
"type": "path",
"style": "diamond",
"background": "#FFE50A",
"foreground": "#000000",
"trailing_diamond": "<#FFE50A, #008000>\ue0b0</>",
"leading_diamond": "<#FF00FF, #FFE50A>\ue0b0</>",
"powerline_symbol": "\ue0b0",
"properties": {
"home_icon": "\ue617",
"mapped_locations": {
"C:\\Program Files": "$PROGRAMFILES",
"C:\\Program Files (x86)": "$PROGRAMFILES32",
"C:\\Users": "\uf007",
"C:\\Windows": "\ue70f",
"D:\\USERNAME": "\ue617",
"D:\\USERNAME\\Dropbox": "\uf16b",
"D:\\USERNAME\\Google Drive": "\ue731",
"D:\\USERNAME\\OneDrive": "\ue762",
"D:\\USERNAME\\OneDrive\\Images\\": "\uf1c5\\",
"D:\\USERNAME\\OneDrive\\Music\\": "\uf001\\"
},
"stack_count_enabled:": true,
"style": "full",
"template": " {{ .Path }} "
}
},
{
"type": "time",
"style": "diamond",
"trailing_diamond": "\ue0b4",
"background": "#008000",
"foreground": "#FFFFFF",
"properties": {
"template": " {{ .CurrentDate | date .Format }} ",
"time_format": "15:04:05"
}
},
{ // Line ending space (Alt+255) to fix prompt mess after window resizing
"type": "text",
"style": "plain",
"properties": { "text": " " }
}
]
},
// =====================
// Prompt: Second Line
// =====================
{
"alignment": "left",
"newline": true,
"type": "prompt",
"segments": [
{
"type": "git",
"style": "diamond",
"trailing_diamond": "\ue0bc",
"background": "#95ffa4",
"foreground": "#193549",
"properties": {
"branch_icon": "\ue0a0",
"fetch_stash_count": true,
"fetch_status": true,
"fetch_upstream_icon": true,
"template": " {{ .HEAD }}{{ .BranchStatus }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Staging.Changed) (.Working.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0}} \uf692 {{ .StashCount }}{{ end }}{{ if gt .WorktreeCount 0}} \uf1bb {{ .WorktreeCount }}{{ end }} "
}
},
{
"type": "text",
"style": "plain",
"properties": {
"template": "ϟ "
}
}
]
}
]
}
@mdnava thx, the text segments are perfectly fine ;-)
@JanDeDobbeleer not sure if I this merits to open a new issue.. let me know if I should.. I'm getting an extra line with the % symbol in Zsh since the v7.33 update. I don't think it was there before:
I'm trying to figure out if it's something I did.. But it only happens in Zsh.
This is the startup code in the .zshrc file (the theme's config file is the same used for all shells):
export PROMPT_PRE_LNBR="TRUE"
export PROMPT_POST_LNBR="TRUE"
eval "$(posh --init --shell zsh --config $EnvScripts/AutoRun/posh-prompt.json)"
@mdnava I don't have that with your config in zsh:
@mdnava I don't have that with your config in zsh:
But it seems you're getting the "zsh>" prompt (instead of %) ?.. It would be essentially the same issue.. that shouldn't appear.. shouldn't it? Press enter and see if the "zsh>" appears again..
I upgraded to v7.37.1 and I got this error on the Cmd Prompt:
> 2022-03-12 19:15 @ v7.37.1
Error: unknown command "D:\\USERNAME\\OneDrive\\Command\\EnvScripts\\AutoRun\\posh-prompt.json" for "oh-my-posh"
Run 'oh-my-posh --help' for usage.
unknown command "D:\\USERNAME\\OneDrive\\Command\\EnvScripts\\AutoRun\\posh-prompt.json" for "oh-my-posh
This happens when the Cmd prompt starts and becomes unusable, but it works in other shells.. I downgraded to v7.37.0 the prompt started working again.
I should also mention that I got the next error earlier today when I upgraded to v7.37.0 a few hours ago: This error happened at the end of a successful gallery-dl.exe command, but the prompt became unusable.
> 2022-03-12 17:30 @ v7.37.0
Error: unknown flag: --error
Usage:
oh-my-posh [flags]
oh-my-posh [command]
System.Management.Automation.RemoteException
Available Commands:
completion Generate the autocompletion script for the specified shell
config Interact with the configuration
help Help about any command
prompt Setup the prompt for your shell
version Print the version
System.Management.Automation.RemoteException
Flags:
-c, --config string config (required)
-h, --help help for oh-my-posh
-i, --init init (deprecated)
-s, --shell string shell (deprecated)
System.Management.Automation.RemoteException
Use "oh-my-posh [command] --help" for more information about a command.
System.Management.Automation.RemoteException
unknown flag: --error
@mdnava the zsh>
prompt is the default transient prompt (I have that enabled in zsh).
But in your test you were using my config file.. it shouldn't be enabled in that test. Anyway.. have a great weekend.
@mdnava enabling that is done outside of the config file. It requires additional shell functionality which can't be set from the config. In my shell config, this feature is enabled, meaning I get the default transient prompt with your config as it isn't specified.
In case anyone else encounters the percent sign (%) issue in Zsh.. I fixed it by adding to .zshrc the following line:
unsetopt PROMPT_SP
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?
Note1: I use the same Posh config file for Cmd, Pwsh, Git bash, Msys2 Bash, Fish, Zsh
My prompt usually works fine, but since the last update to v7.33+ (and today also happened with v7.36) I get this error from time to time (it seems to happen randomly):
Theme
No theme, my own prompt..
What OS are you seeing the problem on?
Windows
Which shell are you using?
zsh, bash, fish, powershell, other (please specify)
Log output