Loading ...
Sorry, an error occurred while loading the content.

Re: sh vs bash syntax coloring

Expand Messages
  • Leiking
    zsh. ... -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are replying to. For more information,
    Message 1 of 18 , Aug 1, 2011
    • 0 Attachment
      zsh.

      2011/8/1 <ranousse@...>:
      >> You can put this option somewher in ~/.zshenv. Or, better, use zsh syntax for
      >> it:
      >>     !action=(xpdf -option) ; ... ; $action file
      >>     !action="xpdf -option" ; ... ; ${(z)action} file
      >>     !action="xpdf -option" ; ... ; $=action file
      >> in last case it is just one more character to type, in the first case you should
      >> type exactly the same number of characters, but two of them are different. These
      >> methods are not the same under all circumstances, but are the same here.
      >> I actually hate using bash for scripting: how do you like using
      >>     command "${array[@]}"
      >> where in zsh you type just
      >>     command $array
      >> . You have to also turn your mind on remembering that you must use quotes around
      >> any parameter if you want it to come in one piece and unmodified.
      >>
      >> I would likely choose zsh, perl, python for scripting but not bash.
      >
      > Ok thank you. I think this will be sufficient for my need.
      > Actually I didn't say bash was better than zsh, but I learnt sh syntax
      > first (not even bash, so no array at all it seems) and I don't know zsh
      > one. I only write small scripts ;-)
      > But I'm sure you're right.
      >
      > --
      > You received this message from the "vim_use" maillist.
      > Do not top-post! Type your reply below the text you are replying to.
      > For more information, visit http://www.vim.org/maillist.php
      >

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Thilo Six
      Charles Campbell wrote the following on 01.08.2011 18:17 Hello Charles, I think here is a typo: -- -- ... ^ `- s:ft-syntax-sh:ft-sh-syntax: :help
      Message 2 of 18 , Aug 1, 2011
      • 0 Attachment
        Charles Campbell wrote the following on 01.08.2011 18:17

        Hello Charles,

        I think here is a typo:

        -- <snip> --

        > Just to be complete, please read :help ft-syntax-sh (g:is_bash is
        ^
        `- s:ft-syntax-sh:ft-sh-syntax:
        ':help ft-syntax-sh' returns E419 to me

        > covered there, for example).
        >
        > Regards,
        > Chip Campbell
        >

        Regards,
        --
        bye Thilo

        4096R/0xC70B1A8F
        721B 1BA0 095C 1ABA 3FC6 7C18 89A4 A2A0 C70B 1A8F


        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • ZyX
        Reply to message «Re: sh vs bash syntax coloring», sent 18:28:38 01 August 2011, Monday ... ?
        Message 3 of 18 , Aug 1, 2011
        • 0 Attachment
          Reply to message «Re: sh vs bash syntax coloring»,
          sent 18:28:38 01 August 2011, Monday
          by Leiking:

          > zsh.
          ?

          Original message:
          > zsh.
          >
          > 2011/8/1 <ranousse@...>:
          > >> You can put this option somewher in ~/.zshenv. Or, better, use zsh
          > >> syntax for it:
          > >> !action=(xpdf -option) ; ... ; $action file
          > >> !action="xpdf -option" ; ... ; ${(z)action} file
          > >> !action="xpdf -option" ; ... ; $=action file
          > >> in last case it is just one more character to type, in the first case
          > >> you should type exactly the same number of characters, but two of them
          > >> are different. These methods are not the same under all circumstances,
          > >> but are the same here. I actually hate using bash for scripting: how do
          > >> you like using command "${array[@]}"
          > >> where in zsh you type just
          > >> command $array
          > >> . You have to also turn your mind on remembering that you must use
          > >> quotes around any parameter if you want it to come in one piece and
          > >> unmodified.
          > >>
          > >> I would likely choose zsh, perl, python for scripting but not bash.
          > >
          > > Ok thank you. I think this will be sufficient for my need.
          > > Actually I didn't say bash was better than zsh, but I learnt sh syntax
          > > first (not even bash, so no array at all it seems) and I don't know zsh
          > > one. I only write small scripts ;-)
          > > But I'm sure you're right.
          > >
          > > --
          > > You received this message from the "vim_use" maillist.
          > > Do not top-post! Type your reply below the text you are replying to.
          > > For more information, visit http://www.vim.org/maillist.php
        • Charles Campbell
          ... Sorry, that should ve been :help ft-sh-syntax . Regards, Chip Campbell -- You received this message from the vim_use maillist. Do not top-post! Type
          Message 4 of 18 , Aug 1, 2011
          • 0 Attachment
            Thilo Six wrote:
            > Charles Campbell wrote the following on 01.08.2011 18:17
            >
            > Hello Charles,
            >
            > I think here is a typo:
            >
            > -- <snip> --
            >
            >
            >> Just to be complete, please read :help ft-syntax-sh (g:is_bash is
            >>
            > ^
            > `- s:ft-syntax-sh:ft-sh-syntax:
            > ':help ft-syntax-sh' returns E419 to me
            >
            Sorry, that should've been :help ft-sh-syntax .

            Regards,
            Chip Campbell

            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • Simon Nicolussi
            ... Not all shells support command substitution via $(...), even though it is required by POSIX. The /bin/sh in Solaris comes to mind. If you know you re using
            Message 5 of 18 , Aug 1, 2011
            • 0 Attachment
              Benjamin R. Haskell wrote:
              > That solves the problem since the OP wants bash syntax. I don't.
              > Is there a reason the constructs mentioned aren't included in "plain
              > 'sh'" mode?

              Not all shells support command substitution via $(...), even though it
              is required by POSIX. The /bin/sh in Solaris comes to mind. If you know
              you're using a compatible shell, you can specify:

              let g:is_posix = 1

              --
              Simon Nicolussi, <Simon.Nicolussi@...>
              http://homepage.uibk.ac.at/~csag9583/
            • Benjamin R. Haskell
              ... [Just FYI:] The /bin/sh in Solaris 10 works fine. Wouldn t surprise me if 5.8 or prior didn t... ... Seems like this should be the default, but okay. I
              Message 6 of 18 , Aug 1, 2011
              • 0 Attachment
                On Mon, 1 Aug 2011, Simon Nicolussi wrote:

                > Benjamin R. Haskell wrote:
                >> That solves the problem since the OP wants bash syntax. I don't. Is
                >> there a reason the constructs mentioned aren't included in "plain
                >> 'sh'" mode?
                >
                > Not all shells support command substitution via $(...), even though it
                > is required by POSIX. The /bin/sh in Solaris comes to mind.

                [Just FYI:] The /bin/sh in Solaris 10 works fine. Wouldn't surprise me
                if 5.8 or prior didn't...


                > If you know you're using a compatible shell, you can specify:
                >
                > let g:is_posix = 1

                Seems like this should be the default, but okay. I see it in the help
                now. Presuming this doesn't affect zsh-detection, I'll just add it and
                be done.

                --
                Thanks,
                Ben

                --
                You received this message from the "vim_use" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php
              • Charles Campbell
                ... You ll also find in the help for ft-sh-syntax the sentence: No need to quote RFCs or market penetration statistics in error reports, please -- just select
                Message 7 of 18 , Aug 2, 2011
                • 0 Attachment
                  Benjamin R. Haskell wrote:
                  > On Mon, 1 Aug 2011, Simon Nicolussi wrote:
                  >
                  >> Benjamin R. Haskell wrote:
                  >>> That solves the problem since the OP wants bash syntax. I don't.
                  >>> Is there a reason the constructs mentioned aren't included in "plain
                  >>> 'sh'" mode?
                  >>
                  >> Not all shells support command substitution via $(...), even though
                  >> it is required by POSIX. The /bin/sh in Solaris comes to mind.
                  >
                  > [Just FYI:] The /bin/sh in Solaris 10 works fine. Wouldn't surprise
                  > me if 5.8 or prior didn't...
                  >
                  >
                  >> If you know you're using a compatible shell, you can specify:
                  >>
                  >> let g:is_posix = 1
                  >
                  > Seems like this should be the default, but okay. I see it in the help
                  > now. Presuming this doesn't affect zsh-detection, I'll just add it
                  > and be done.
                  >
                  You'll also find in the help for ft-sh-syntax the sentence:

                  No need to quote RFCs or market penetration statistics in error
                  reports, please -- just select the default version of the sh your system
                  uses in your <.vimrc>.

                  That's there because posix/ksh users like to quote RFCs about how the
                  default should be is_posix, and bash users like to quote market
                  penetration statistics to insist that the default should be is_bash. I
                  have the Bourne shell as default, not because I particularly like it the
                  best or anything (I'm a is_kornshell user, myself), but to encourage
                  users to make an informed choice.

                  However, please try v117 of sh.vim; it now has some logic using
                  resolve() to attempt to guess which shell is wanted. It won't be
                  perfect; for example, what shell should be used with .profile? On my
                  system, /bin/sh is linked to bash, and so the guessing logic will come
                  up with setting g:is_bash to one; however, my login shell is ksh, and so
                  .profile should be interpreted with g:is_kornshell = 1. The guess will
                  only be made if no g:is_posix, g:is_kornshell, g:is_bash, or g:is_sh exists.

                  You may get v117 from my website:
                  http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax .

                  Regards,
                  Chip Campbell

                  --
                  You received this message from the "vim_use" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php
                Your message has been successfully submitted and would be delivered to recipients shortly.