Why does zsh list my prompt incorrectly on OS X?












0















I'm trying to figure out why zsh's prompt looks like this:



zsh prompt example



(in text form):



[]u[] at []h[] in []w[]$(__git_ps1) []$(git_diff)n[]($(date +'1:MikesMBP.local ')) []$[]


I'd like it to list my pwd and username normally like it does in bash before calling zsh. Here's my .zshrc:



# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory autocd beep extendedglob nomatch notify
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/Users/mike/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall


This is just a standard config created when first starting zsh. I've tried both the built-in OS X zsh and homebrew's zsh and they produce the same error. Do you see something that would cause this?










share|improve this question









New contributor




PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I'm trying to figure out why zsh's prompt looks like this:



    zsh prompt example



    (in text form):



    []u[] at []h[] in []w[]$(__git_ps1) []$(git_diff)n[]($(date +'1:MikesMBP.local ')) []$[]


    I'd like it to list my pwd and username normally like it does in bash before calling zsh. Here's my .zshrc:



    # Lines configured by zsh-newuser-install
    HISTFILE=~/.histfile
    HISTSIZE=1000
    SAVEHIST=1000
    setopt appendhistory autocd beep extendedglob nomatch notify
    bindkey -v
    # End of lines configured by zsh-newuser-install
    # The following lines were added by compinstall
    zstyle :compinstall filename '/Users/mike/.zshrc'

    autoload -Uz compinit
    compinit
    # End of lines added by compinstall


    This is just a standard config created when first starting zsh. I've tried both the built-in OS X zsh and homebrew's zsh and they produce the same error. Do you see something that would cause this?










    share|improve this question









    New contributor




    PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I'm trying to figure out why zsh's prompt looks like this:



      zsh prompt example



      (in text form):



      []u[] at []h[] in []w[]$(__git_ps1) []$(git_diff)n[]($(date +'1:MikesMBP.local ')) []$[]


      I'd like it to list my pwd and username normally like it does in bash before calling zsh. Here's my .zshrc:



      # Lines configured by zsh-newuser-install
      HISTFILE=~/.histfile
      HISTSIZE=1000
      SAVEHIST=1000
      setopt appendhistory autocd beep extendedglob nomatch notify
      bindkey -v
      # End of lines configured by zsh-newuser-install
      # The following lines were added by compinstall
      zstyle :compinstall filename '/Users/mike/.zshrc'

      autoload -Uz compinit
      compinit
      # End of lines added by compinstall


      This is just a standard config created when first starting zsh. I've tried both the built-in OS X zsh and homebrew's zsh and they produce the same error. Do you see something that would cause this?










      share|improve this question









      New contributor




      PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I'm trying to figure out why zsh's prompt looks like this:



      zsh prompt example



      (in text form):



      []u[] at []h[] in []w[]$(__git_ps1) []$(git_diff)n[]($(date +'1:MikesMBP.local ')) []$[]


      I'd like it to list my pwd and username normally like it does in bash before calling zsh. Here's my .zshrc:



      # Lines configured by zsh-newuser-install
      HISTFILE=~/.histfile
      HISTSIZE=1000
      SAVEHIST=1000
      setopt appendhistory autocd beep extendedglob nomatch notify
      bindkey -v
      # End of lines configured by zsh-newuser-install
      # The following lines were added by compinstall
      zstyle :compinstall filename '/Users/mike/.zshrc'

      autoload -Uz compinit
      compinit
      # End of lines added by compinstall


      This is just a standard config created when first starting zsh. I've tried both the built-in OS X zsh and homebrew's zsh and they produce the same error. Do you see something that would cause this?







      shell osx zsh prompt






      share|improve this question









      New contributor




      PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 1 hour ago









      Jeff Schaller

      39.3k1054125




      39.3k1054125






      New contributor




      PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 1 hour ago









      PascLeRascPascLeRasc

      1011




      1011




      New contributor




      PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          2 Answers
          2






          active

          oldest

          votes


















          0














          bash uses [ and ] to mark parts of the prompt which are nonprinting.



          zsh uses %{ and %} for the same purpose.



          The xterm manual has a section which mentions this.






          share|improve this answer
























          • So if I start my terminal with zsh as the default shell it'll fix it?

            – PascLeRasc
            1 hour ago











          • no - see other answer: zsh is seeing the PS1 which bash knows how to handle.

            – Thomas Dickey
            1 hour ago



















          0














          You exported the variable PS1 in the previous shell so zsh inherits it and uses the variable to display your prompt. This is the reason why you should not export shell parameters like PS*, had PS1 not be exported zsh would've used its default prompt until you changed PS1 in your .zshrc or used the prompt system.






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });






            PascLeRasc is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f494326%2fwhy-does-zsh-list-my-prompt-incorrectly-on-os-x%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            bash uses [ and ] to mark parts of the prompt which are nonprinting.



            zsh uses %{ and %} for the same purpose.



            The xterm manual has a section which mentions this.






            share|improve this answer
























            • So if I start my terminal with zsh as the default shell it'll fix it?

              – PascLeRasc
              1 hour ago











            • no - see other answer: zsh is seeing the PS1 which bash knows how to handle.

              – Thomas Dickey
              1 hour ago
















            0














            bash uses [ and ] to mark parts of the prompt which are nonprinting.



            zsh uses %{ and %} for the same purpose.



            The xterm manual has a section which mentions this.






            share|improve this answer
























            • So if I start my terminal with zsh as the default shell it'll fix it?

              – PascLeRasc
              1 hour ago











            • no - see other answer: zsh is seeing the PS1 which bash knows how to handle.

              – Thomas Dickey
              1 hour ago














            0












            0








            0







            bash uses [ and ] to mark parts of the prompt which are nonprinting.



            zsh uses %{ and %} for the same purpose.



            The xterm manual has a section which mentions this.






            share|improve this answer













            bash uses [ and ] to mark parts of the prompt which are nonprinting.



            zsh uses %{ and %} for the same purpose.



            The xterm manual has a section which mentions this.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 1 hour ago









            Thomas DickeyThomas Dickey

            52.2k594165




            52.2k594165













            • So if I start my terminal with zsh as the default shell it'll fix it?

              – PascLeRasc
              1 hour ago











            • no - see other answer: zsh is seeing the PS1 which bash knows how to handle.

              – Thomas Dickey
              1 hour ago



















            • So if I start my terminal with zsh as the default shell it'll fix it?

              – PascLeRasc
              1 hour ago











            • no - see other answer: zsh is seeing the PS1 which bash knows how to handle.

              – Thomas Dickey
              1 hour ago

















            So if I start my terminal with zsh as the default shell it'll fix it?

            – PascLeRasc
            1 hour ago





            So if I start my terminal with zsh as the default shell it'll fix it?

            – PascLeRasc
            1 hour ago













            no - see other answer: zsh is seeing the PS1 which bash knows how to handle.

            – Thomas Dickey
            1 hour ago





            no - see other answer: zsh is seeing the PS1 which bash knows how to handle.

            – Thomas Dickey
            1 hour ago













            0














            You exported the variable PS1 in the previous shell so zsh inherits it and uses the variable to display your prompt. This is the reason why you should not export shell parameters like PS*, had PS1 not be exported zsh would've used its default prompt until you changed PS1 in your .zshrc or used the prompt system.






            share|improve this answer




























              0














              You exported the variable PS1 in the previous shell so zsh inherits it and uses the variable to display your prompt. This is the reason why you should not export shell parameters like PS*, had PS1 not be exported zsh would've used its default prompt until you changed PS1 in your .zshrc or used the prompt system.






              share|improve this answer


























                0












                0








                0







                You exported the variable PS1 in the previous shell so zsh inherits it and uses the variable to display your prompt. This is the reason why you should not export shell parameters like PS*, had PS1 not be exported zsh would've used its default prompt until you changed PS1 in your .zshrc or used the prompt system.






                share|improve this answer













                You exported the variable PS1 in the previous shell so zsh inherits it and uses the variable to display your prompt. This is the reason why you should not export shell parameters like PS*, had PS1 not be exported zsh would've used its default prompt until you changed PS1 in your .zshrc or used the prompt system.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 1 hour ago









                lluallua

                4,7091420




                4,7091420






















                    PascLeRasc is a new contributor. Be nice, and check out our Code of Conduct.










                    draft saved

                    draft discarded


















                    PascLeRasc is a new contributor. Be nice, and check out our Code of Conduct.













                    PascLeRasc is a new contributor. Be nice, and check out our Code of Conduct.












                    PascLeRasc is a new contributor. Be nice, and check out our Code of Conduct.
















                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f494326%2fwhy-does-zsh-list-my-prompt-incorrectly-on-os-x%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    宮崎県

                    濃尾地震

                    6月16日