JanDeDobbeleer / oh-my-posh

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

iterm2 support? #2257

Closed dcsan closed 2 years ago

dcsan commented 2 years ago

Code of Conduct

What happened?

I followed install info and added this so as to avoid using apple's terminal

if [ $TERM_PROGRAM != "Apple_Terminal" ]; then
  eval "$(oh-my-posh init zsh)"
fi

on opening a new terminal I get this:

image

Theme

haven't got into customizing yet.

What OS are you seeing the problem on?

macOS

Which shell are you using?

zsh, other (please specify):

I'm using zsh with iTerm2 Build 3.4.15

Log output

image


 dc   ~    oh-my-posh debug                          in zsh at 00:21:00

Version: 7.81.3

Segments:

ConsoleTitle(true) -   1 ms - zsh in ~
session(true)  -   0 ms -  dc 
path(true)     -   0 ms -   ~
git(false)     -   0 ms -
root(false)    -   0 ms -
exit(true)     -   0 ms -   
node(false)    -   0 ms -
go(false)      -   0 ms -
python(false)  -   0 ms -
shell(true)    -   0 ms - in zsh
time(true)     -   0 ms - at 00:21:12

Run duration: 5.468916ms

Cache path: /Users/dc/.cache/oh-my-posh

Config path: /Users/dc/.cache/oh-my-posh/config.omp.json

Logs:

2022/05/12 00:21:12 debug: Getenv

2022/05/12 00:21:12 Getenv duration: 5.208µs, args: XDG_CACHE_HOME
2022/05/12 00:21:12 CachePath duration: 31.584µs, args:
2022/05/12 00:21:12 debug: Getenv
/Users/dc/.cache/oh-my-posh/config.omp.json
2022/05/12 00:21:12 Getenv duration: 4.291µs, args: POSH_THEME
2022/05/12 00:21:12 resolveConfigPath duration: 6.125µs, args:
2022/05/12 00:21:12 Init duration: 92.083µs, args:
2022/05/12 00:21:12 Flags duration: 208ns, args:
2022/05/12 00:21:12 config.loadConfig duration: 1.20875ms, args:
2022/05/12 00:21:12 Flags duration: 42ns, args:
2022/05/12 00:21:12 debug: Getenv

2022/05/12 00:21:12 Getenv duration: 1.084µs, args: OMP_CACHE_DISABLED
2022/05/12 00:21:12 Root duration: 1.417µs, args:
2022/05/12 00:21:12 Shell duration: 103.167µs, args:
2022/05/12 00:21:12 ErrorCode duration: 125ns, args:
2022/05/12 00:21:12 debug: Getenv

2022/05/12 00:21:12 Getenv duration: 917ns, args: WSL_DISTRO_NAME
2022/05/12 00:21:12 IsWsl duration: 2.042µs, args:
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 16.083µs, args:
2022/05/12 00:21:12 PathSeparator duration: 42ns, args:
2022/05/12 00:21:12 PathSeparator duration: 41ns, args:
2022/05/12 00:21:12 debug: User
dc
2022/05/12 00:21:12 User duration: 1.583µs, args:
2022/05/12 00:21:12 debug: Host
emi
2022/05/12 00:21:12 Host duration: 4.167µs, args:
2022/05/12 00:21:12 GOOS duration: 41ns, args:
2022/05/12 00:21:12 TemplateCache duration: 148.833µs, args:
2022/05/12 00:21:12 Flags duration: 41ns, args:
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 1.333µs, args:
2022/05/12 00:21:12 GOOS duration: 42ns, args:
2022/05/12 00:21:12 debug: Getenv

2022/05/12 00:21:12 Getenv duration: 750ns, args: SSH_CONNECTION
2022/05/12 00:21:12 debug: Getenv

2022/05/12 00:21:12 Getenv duration: 2.583µs, args: SSH_CLIENT
2022/05/12 00:21:12 TemplateCache duration: 42ns, args:
2022/05/12 00:21:12 TemplateCache duration: 84ns, args:
2022/05/12 00:21:12 Shell duration: 42ns, args:
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 1.125µs, args:
2022/05/12 00:21:12 GOOS duration: 0s, args:
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 458ns, args:
2022/05/12 00:21:12 Flags duration: 42ns, args:
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 500ns, args:
2022/05/12 00:21:12 GOOS duration: 0s, args:
2022/05/12 00:21:12 GOOS duration: 42ns, args:
2022/05/12 00:21:12 PathSeparator duration: 0s, args:
2022/05/12 00:21:12 PathSeparator duration: 42ns, args:
2022/05/12 00:21:12 PathSeparator duration: 42ns, args:
2022/05/12 00:21:12 GOOS duration: 42ns, args:
2022/05/12 00:21:12 debug: Getenv

2022/05/12 00:21:12 Getenv duration: 583ns, args: WSL_DISTRO_NAME
2022/05/12 00:21:12 IsWsl duration: 1.458µs, args:
2022/05/12 00:21:12 StackCount duration: 125ns, args:
2022/05/12 00:21:12 TemplateCache duration: 42ns, args:
2022/05/12 00:21:12 TemplateCache duration: 41ns, args:
2022/05/12 00:21:12 Shell duration: 41ns, args:
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 958ns, args:
2022/05/12 00:21:12 GOOS duration: 0s, args:
2022/05/12 00:21:12 debug: Getenv

2022/05/12 00:21:12 Getenv duration: 1µs, args: WSL_DISTRO_NAME
2022/05/12 00:21:12 IsWsl duration: 2.083µs, args:
2022/05/12 00:21:12 GOOS duration: 42ns, args:
2022/05/12 00:21:12 HasCommand duration: 57.333µs, args: git
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 459ns, args:
2022/05/12 00:21:12 error: HasParentFilePath
stat /.git: no such file or directory
2022/05/12 00:21:12 HasParentFilePath duration: 18.667µs, args: .git
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 500ns, args:
2022/05/12 00:21:12 GOOS duration: 0s, args:
2022/05/12 00:21:12 Root duration: 292ns, args:
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 500ns, args:
2022/05/12 00:21:12 GOOS duration: 42ns, args:
2022/05/12 00:21:12 ErrorCode duration: 41ns, args:
2022/05/12 00:21:12 TemplateCache duration: 42ns, args:
2022/05/12 00:21:12 TemplateCache duration: 84ns, args:
2022/05/12 00:21:12 Shell duration: 41ns, args:
2022/05/12 00:21:12 TemplateCache duration: 42ns, args:
2022/05/12 00:21:12 Flags duration: 42ns, args:
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 541ns, args:
2022/05/12 00:21:12 GOOS duration: 0s, args:
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 7.083µs, args:
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 750ns, args:
2022/05/12 00:21:12 GOOS duration: 42ns, args:
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 500ns, args:
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 625ns, args:
2022/05/12 00:21:12 GOOS duration: 42ns, args:
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 417ns, args:
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 542ns, args:
2022/05/12 00:21:12 PathSeparator duration: 41ns, args:
2022/05/12 00:21:12 debug: HasFiles
false
2022/05/12 00:21:12 HasFiles duration: 241.041µs, args: *.py
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 458ns, args:
2022/05/12 00:21:12 PathSeparator duration: 0s, args:
2022/05/12 00:21:12 debug: HasFiles
false
2022/05/12 00:21:12 HasFiles duration: 200.417µs, args: *.ipynb
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 458ns, args:
2022/05/12 00:21:12 PathSeparator duration: 41ns, args:
2022/05/12 00:21:12 debug: HasFiles
false
2022/05/12 00:21:12 HasFiles duration: 9.292µs, args: pyproject.toml
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 416ns, args:
2022/05/12 00:21:12 PathSeparator duration: 42ns, args:
2022/05/12 00:21:12 debug: HasFiles
false
2022/05/12 00:21:12 HasFiles duration: 6.75µs, args: venv.bak
2022/05/12 00:21:12 debug: HasFolder
false
2022/05/12 00:21:12 HasFolder duration: 5µs, args: .venv
2022/05/12 00:21:12 debug: HasFolder
false
2022/05/12 00:21:12 HasFolder duration: 4.667µs, args: venv
2022/05/12 00:21:12 debug: HasFolder
false
2022/05/12 00:21:12 HasFolder duration: 4.958µs, args: virtualenv
2022/05/12 00:21:12 debug: HasFolder
false
2022/05/12 00:21:12 HasFolder duration: 5.25µs, args: env
2022/05/12 00:21:12 debug: HasFolder
false
2022/05/12 00:21:12 HasFolder duration: 4.458µs, args: venv-win
2022/05/12 00:21:12 debug: HasFolder
false
2022/05/12 00:21:12 HasFolder duration: 4.208µs, args: pyenv-win
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 542ns, args:
2022/05/12 00:21:12 GOOS duration: 41ns, args:
2022/05/12 00:21:12 Shell duration: 42ns, args:
2022/05/12 00:21:12 Flags duration: 42ns, args:
2022/05/12 00:21:12 TemplateCache duration: 42ns, args:
2022/05/12 00:21:12 TemplateCache duration: 83ns, args:
2022/05/12 00:21:12 Shell duration: 42ns, args:
2022/05/12 00:21:12 debug: Pwd
/Users/dc
2022/05/12 00:21:12 Pwd duration: 667ns, args:
2022/05/12 00:21:12 GOOS duration: 41ns, args:
2022/05/12 00:21:12 TemplateCache duration: 42ns, args:
2022/05/12 00:21:12 TemplateCache duration: 41ns, args:
2022/05/12 00:21:12 Shell duration: 83ns, args:
2022/05/12 00:21:12 debug: Getenv

2022/05/12 00:21:12 Getenv duration: 875ns, args: XDG_CACHE_HOME
2022/05/12 00:21:12 CachePath duration: 8.667µs, args:
2022/05/12 00:21:12 Flags duration: 41ns, args:
 dc   ~                                                                                                 in zsh at 00:21:12
lewis-yeung commented 2 years ago

Have you installed a Nerd Font which is required for displaying all special symbols/icons? And you should use that font in you terminal app.

JanDeDobbeleer commented 2 years ago

@dcsan what @lewis-yeung said is correct!

dcsan commented 2 years ago

I've been hunting around on the site to find out what is required to set this up

the font page isn't helpful

image

I can get the font. installed on system. still doesn't fix the problem. https://ohmyposh.dev/docs/configuration/fonts

do i have to download and edit a theme to "configure" it to use the right nerd font?

dcsan commented 2 years ago

OK i guess i have to change the settings manually in the terminal app? so the theme is unable to specify a font?

but some themes maybe require a specific font? recursive still seems broken

image

and what is this zsh no-config stuff that is now filling out every terminal prompt, even in a git directory?

JanDeDobbeleer commented 2 years ago

@dcsan it seems you're having some trouble understanding the different concepts here. oh-my-posh only hooks into the shell's prompt function(s), which means it outputs a string that the shell interprets and the terminal needs to render. The output is ANSI which tells the terminal what colors/text decorations to use. Icons etc are all part of the font which is a terminal configuration, not something oh-my-posh can influence. that's why it says "configure your terminal to use it". Depending on the font, sometimes certain characters aren't in there (also goes for nerd fonts and where the char is at), I personally use VictorMono.

The fact that this prompt shows no config (zsh is an indication of the shell, that's just a segment) is the the config your provided doesn't exist in that location (the --config flag has a value that doesn't resolve to an actual path/file oh-my-posh can access).

JanDeDobbeleer commented 2 years ago

@dcsan closing as this isn't an issue with oh-my-posh, we can keep the conversation alive in case you have any questions.

wesamly commented 2 years ago

As mentioned by @lewis-yeung, you need to use Nerd Font in iTerm2 to make it display correctly. Preferences > Profiles > Select Profile > Text > Set Font.

github-actions[bot] commented 10 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.