You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using nu compiled with starship prompt support, the prompt appears mangled. See screenshot.
%{%}~%{%}
%{%}->%{%} cd aur-build/nushell/
%{%}nushell%{%} on %{%} %{%}%{%}master%{%} is %{%}📦 %{%}%{%}v0.5.1%{%} via %{%}🦀 %{%}%{%}v1.39.0%{%}
%{%}->%{%}
I'm trying to figure out what might be causing it. I'm able to run Kitty and Nu together with Nu as my main shell (though I needed to tweak Kitty a tiny bit to allow it):
Hmm, I'm also seeing it work correctly in Kitty with bash + nu:
Trying to think what might be different. I'm using the default fonts on pop! OS: Fira Mono Regular.
If you run through something like GNOME terminal with the default color scheme, do you get the same behavior? I'm wondering if we can isolate if it's the color scheme, the terminal, the font, or something else.
Disabling ligatures does not help (in Kitty or Alacritty)
Switching to Fira Mono or DejaVu does not help (in Kitty or Alacritty)
Switching to upstream alacritty (whatever Arch has) does not help
Using GNOME Terminal out-of-the-box does not help
Switching the colorscheme in Kitty does not help (I was using this)
I am using starship in zsh and it works great. I'm stumped as to what else could be different. I am on the latest master, fe53c37, still built with all features.
Every terminal (alacritty, iterm2, builtin) was mangled if nu was run from the command line.
exec nu where it should have replaced the zsh process did nothing
Every terminal works with nushell if you put it in /etc/shells and then chsh your user to it
What this makes me understand is that unless it's your default shell it fails to produce non garbled output. I don't know exactly what does it, but zsh requires one to add eval "$(starship init zsh)" in order for it to be used as the prompt. Maybe something isn't being set if nushell runs as a subprocess.
Reacted by Avi Dessauer, Alex van de Sandt and MarvinX
$ cat /etc/fonts/fonts.conf
<?xml version="1.0"?>
<!DOCTYPEfontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/fonts.conf file to configure system font access -->
<fontconfig>
<its:rulesxmlns:its="http://www.w3.org/2005/11/its"version="1.0">
<its:translateRuletranslate="no"selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
<description>Default configuration file</description>
<!-- Font directory list -->
<dir>/usr/share/fonts</dir>
<dir>/usr/local/share/fonts</dir>
<dirprefix="xdg">fonts</dir>
<!-- the following element will be removed in the future -->
<dir>~/.fonts</dir>
<!-- Accept deprecated 'mono' alias, replacing it with 'monospace'-->
<matchtarget="pattern">
<testqual="any"name="family">
<string>mono</string>
</test>
<editname="family"mode="assign"binding="same">
<string>monospace</string>
</edit>
</match>
<!-- Accept alternate 'sans serif' spelling, replacing it with 'sans-serif'-->
<matchtarget="pattern">
<testqual="any"name="family">
<string>sans serif</string>
</test>
<editname="family"mode="assign"binding="same">
<string>sans-serif</string>
</edit>
</match>
<!-- Accept deprecated 'sans' alias, replacing it with 'sans-serif'-->
<matchtarget="pattern">
<testqual="any"name="family">
<string>sans</string>
</test>
<editname="family"mode="assign"binding="same">
<string>sans-serif</string>
</edit>
</match>
<!-- Accept alternate 'system ui' spelling, replacing it with 'system-ui'-->
<matchtarget="pattern">
<testqual="any"name="family">
<string>system ui</string>
</test>
<editname="family"mode="assign"binding="same">
<string>system-ui</string>
</edit>
</match>
<!-- Load local system customization file-->
<includeignore_missing="yes">conf.d</include>
<!-- Font cache directory list -->
<cachedir>/var/cache/fontconfig</cachedir>
<cachedirprefix="xdg">fontconfig</cachedir>
<!-- the following element will be removed in the future -->
<cachedir>~/.fontconfig</cachedir>
<config>
<!-- Rescan configuration every 30 seconds when FcFontSetList is called-->
<rescan>
<int>30</int>
</rescan>
</config>
</fontconfig>
I was seeing the same issue when I ran nu from zsh. What fixed it for me was disabling starship (commenting out the init line # eval "$(starship init zsh)") in zsh before running nu.
I can confirm what @mgattozzi said; If i chsh -s $(which nu), everything works great. What's also interesting is if I launch a terminal with nu as the shell, launch zsh from that, then launch nu again, the prompt is broken. If I do what @jeffhertzler just said, the prompt works.
nu works
bash -> nu works
zsh -> nu does not work
nu -> zsh -> nu does not work
nu -> bash -> nu works
zsh w/o starship -> nu works
So it sounds like it's an issue of the starship init zsh script being run before initializing nu. It's probably not an issue of system configuration.
For those having issues, if you unset the STARSHIP_SHELL environment variable when running nushell (for example, STARSHIP_SHELL="" nu), do you still have the same issue?
Activity
sophiajt commentedon Nov 24, 2019
I don't think this will fix it, but do you get the same behavior with
cargo install --path . --force --all-features?igneousflock commentedon Nov 24, 2019
Same behavior, unfortunately.
sophiajt commentedon Nov 25, 2019
I'm trying to figure out what might be causing it. I'm able to run Kitty and Nu together with Nu as my main shell (though I needed to tweak Kitty a tiny bit to allow it):
Let me also try running via bash
sophiajt commentedon Nov 25, 2019
Hmm, I'm also seeing it work correctly in Kitty with bash + nu:
Trying to think what might be different. I'm using the default fonts on pop! OS: Fira Mono Regular.
If you run through something like GNOME terminal with the default color scheme, do you get the same behavior? I'm wondering if we can isolate if it's the color scheme, the terminal, the font, or something else.
igneousflock commentedon Nov 25, 2019
I was using Fira Code font with ligatures
I am using starship in zsh and it works great. I'm stumped as to what else could be different. I am on the latest master,
fe53c37, still built with all features.sphinxc0re commentedon Nov 27, 2019
Same problem here. Usually using zsh with starship prompt.
mgattozzi commentedon Nov 27, 2019
I did some manual testing on osx
What this makes me understand is that unless it's your default shell it fails to produce non garbled output. I don't know exactly what does it, but zsh requires one to add
eval "$(starship init zsh)"in order for it to be used as the prompt. Maybe something isn't being set if nushell runs as a subprocess.mgattozzi commentedon Nov 27, 2019
Some followup testing this is messed up from a zsh shell that isn't using starship as well.
tchak commentedon Nov 27, 2019
Mine looks like this:

I am assuming it's the same problem?
Avi-D-coder commentedon Nov 28, 2019
This makes
nuunusable for me.sophiajt commentedon Nov 28, 2019
@Avi-D-coder - you can use Nu without this feature enabled. If you do
cargo install nuit will give you the non-starship promptsophiajt commentedon Nov 28, 2019
In case anyone wants to help figure it out, these are the configurations I've tried:
Ubuntu/Pop! OS:
nufrom inside zsh (works)nufrom inside zsh (works)nuform inside zsh (works)macOS 10.15.1 (default font):
nufrom inside zsh (works)nufrom inside zsh (works)sophiajt commentedon Nov 28, 2019
@avandesa - Can you also post the font, starship config, and alacritty config?
I'm trying to think of other ways the systems might be different, or ways I could repro short of building an arch linux image.
igneousflock commentedon Nov 28, 2019
Here are my configurations:
alacritty.yml
jeffhertzler commentedon Nov 28, 2019
I was seeing the same issue when I ran
nufromzsh. What fixed it for me was disabling starship (commenting out the init line# eval "$(starship init zsh)") inzshbefore runningnu.igneousflock commentedon Nov 28, 2019
I can confirm what @mgattozzi said; If i
chsh -s $(which nu), everything works great. What's also interesting is if I launch a terminal withnuas the shell, launch zsh from that, then launch nu again, the prompt is broken. If I do what @jeffhertzler just said, the prompt works.nuworksbash -> nuworkszsh -> nudoes not worknu -> zsh -> nudoes not worknu -> bash -> nuworkszsh w/o starship -> nuworksSo it sounds like it's an issue of the
starship init zshscript being run before initializing nu. It's probably not an issue of system configuration.tchak commentedon Nov 28, 2019
In my case I start
nufrombashon MacOS. I tried to removeeval "$(starship init bash)"from my.bash_profile– it changes nothing.thegedge commentedon Nov 29, 2019
For those having issues, if you unset the
STARSHIP_SHELLenvironment variable when running nushell (for example,STARSHIP_SHELL="" nu), do you still have the same issue?tchak commentedon Nov 29, 2019
@thegedge it makes no difference for me
sophiajt commentedon Nov 29, 2019
I just landed a possible fix for this (#1029). For folks who are having this issue, can you try the latest master?
Once you check it out, you can build and run it with:
tchak commentedon Nov 29, 2019
works for me
mgattozzi commentedon Nov 30, 2019
Confirms this works for me!
igneousflock commentedon Nov 30, 2019
The fix works. I'll be closing this issue since it appears to be resolved.
Thanks so much for your help @jonathandturner!
Avi-D-coder commentedon Sep 6, 2020
This is broken again.
I have to use
unset STARSHIP_SHELL && nuso the prompt does not get mangled.CBenoit commentedon Oct 26, 2020
I have the same issue on master built and installed using
cargo install --features=extra --path .Commit is 1b0ed30
By running
unset STARSHIP_SHELL && nuthere is no issue.I'm not sure if the issue comes from
nuorstarshipthough. I'm runningnufrom myzshshell that is already usingstarshipas prompt.ibraheemdev commentedon Nov 13, 2020
I'm having the same issue using
nuas my login shellrrichardson commentedon Nov 25, 2020
Following the lead from @CBenoit 's comment. This works and is a bit more ergonomic.
In your ~/.config/nu/config.toml
Finish `let-env` removal in Chinese translation (nushell#1005)