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

sh vs bash syntax coloring

Expand Messages
  • ranousse@gmx.com
    I m not very happy with syntax coloring of sh scripts (starting with #!/bin/sh). For example, things like $(command), $((n+1)) or ${var%.txt} are very badly
    Message 1 of 18 , Jul 31, 2011
    • 0 Attachment
      I'm not very happy with syntax coloring of sh scripts (starting with
      #!/bin/sh). For example, things like
      $(command), $((n+1)) or ${var%.txt} are very badly displayed.
      However they are part of POSIX sh I think.

      Do you know a simple hack to correct this. Something that could interest
      me would be always using bash syntax coloring even with
      #!/bin/sh
      at the beginning.

      I thought of modelines but vim seems to use the same syntax file for sh
      and bash and thus I cannot use something like
      # vi: syntax=bash
      or
      # vi: ft=bash

      --
      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
      ranousse@gmx.com wrote the following on 31.07.2011 12:42 Hello ... ,----[ :h ft-sh-syntax ]---------------------- let g:is_bash = 1
      Message 2 of 18 , Jul 31, 2011
      • 0 Attachment
        ranousse@... wrote the following on 31.07.2011 12:42

        Hello

        > I'm not very happy with syntax coloring of sh scripts (starting with
        > #!/bin/sh). For example, things like
        > $(command), $((n+1)) or ${var%.txt} are very badly displayed.
        > However they are part of POSIX sh I think.
        >
        > Do you know a simple hack to correct this. Something that could interest
        > me would be always using bash syntax coloring even with
        > #!/bin/sh
        > at the beginning.
        >
        > I thought of modelines but vim seems to use the same syntax file for sh
        > and bash and thus I cannot use something like
        > # vi: syntax=bash
        > or
        > # vi: ft=bash
        >


        ,----[ :h ft-sh-syntax ]----------------------

        < bash: >
        let g:is_bash = 1
        `---------------------------------------------


        --
        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
      • ranousse@gmx.com
        ... So there is no trick at all, I only have to choose the right option. Thank you very much. By the way I have another question concerning shell and vim. I m
        Message 3 of 18 , Jul 31, 2011
        • 0 Attachment
          On 31/07 13:49, Thilo Six wrote:
          > ,----[ :h ft-sh-syntax ]----------------------
          >
          > < bash: >
          > let g:is_bash = 1
          > `---------------------------------------------

          So there is no trick at all, I only have to choose the right option.
          Thank you very much.

          By the way I have another question concerning shell and vim.
          I'm using zsh as interactive shell (because of completion possibilities)
          but I prefer bash/sh to write scripts.

          So when I type
          :!shell_command
          I would prefer it was seen as bash code by vim
          and when I type
          :sh
          I would prefer vim opens zsh as interactive shell.

          I know I can do
          :set sh=bash
          but it changes shell in both case.

          --
          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:07:46 31 July 2011, Sunday ... Use in normal mode instead. It won t launch anything, it will
          Message 4 of 18 , Jul 31, 2011
          • 0 Attachment
            Reply to message «Re: sh vs bash syntax coloring»,
            sent 18:07:46 31 July 2011, Sunday
            by ranousse@...:

            > I would prefer it was seen as bash code by vim
            > and when I type
            >
            > :sh
            >
            > I would prefer vim opens zsh as interactive shell.
            Use <C-z> in normal mode instead. It won't launch anything, it will instead
            suspend vim so that you will see shell you opened vim from. Obviously,
            set shell=bash
            won't have any affect on shell that is already launched.

            Original message:
            > On 31/07 13:49, Thilo Six wrote:
            > > ,----[ :h ft-sh-syntax ]----------------------
            > >
            > > < bash: >
            > >
            > > let g:is_bash = 1
            > >
            > > `---------------------------------------------
            >
            > So there is no trick at all, I only have to choose the right option.
            > Thank you very much.
            >
            > By the way I have another question concerning shell and vim.
            > I'm using zsh as interactive shell (because of completion possibilities)
            > but I prefer bash/sh to write scripts.
            >
            > So when I type
            >
            > :!shell_command
            >
            > I would prefer it was seen as bash code by vim
            > and when I type
            >
            > :sh
            >
            > I would prefer vim opens zsh as interactive shell.
            >
            > I know I can do
            >
            > :set sh=bash
            >
            > but it changes shell in both case.
          • ranousse@gmx.com
            ... Yes indeed it s a solution. With also one drawback :-( : I often launch vim, with xterm -e vim, and in this case I cannot use . -- You received this
            Message 5 of 18 , Jul 31, 2011
            • 0 Attachment
              > > By the way I have another question concerning shell and vim.
              > > I'm using zsh as interactive shell (because of completion possibilities)
              > > but I prefer bash/sh to write scripts.
              > >
              > > So when I type
              > >
              > > :!shell_command
              > >
              > > I would prefer it was seen as bash code by vim
              > > and when I type
              > >
              > > :sh
              > >
              > > I would prefer vim opens zsh as interactive shell.
              > >
              > > I know I can do
              > >
              > > :set sh=bash
              > >
              > > but it changes shell in both case.

              On 31/07 18:25, ZyX wrote:

              > Use <C-z> in normal mode instead. It won't launch anything, it will instead
              > suspend vim so that you will see shell you opened vim from. Obviously,
              > set shell=bash
              > won't have any affect on shell that is already launched.

              Yes indeed it's a solution. With also one drawback :-( :
              I often launch vim, with xterm -e vim, and in this case I cannot use
              <c-z>.

              --
              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
            • Gary Johnson
              ... I m not sure I understand the problem. If you write your shell scripts with #!/bin/bash as the first line, they will be executed by bash, regardless of
              Message 6 of 18 , Jul 31, 2011
              • 0 Attachment
                On 2011-07-31, ranousse wrote:

                > By the way I have another question concerning shell and vim.
                > I'm using zsh as interactive shell (because of completion possibilities)
                > but I prefer bash/sh to write scripts.
                >
                > So when I type
                > :!shell_command
                > I would prefer it was seen as bash code by vim
                > and when I type
                > :sh
                > I would prefer vim opens zsh as interactive shell.

                I'm not sure I understand the problem. If you write your shell
                scripts with

                #!/bin/bash

                as the first line, they will be executed by bash, regardless of the
                shell they were started from.

                What behavior do you want from

                :!shell_command

                that you get from bash that you don't get from zsh?

                > I know I can do
                > :set sh=bash
                > but it changes shell in both case.

                You could create a ~/.bashrc that contains just

                exec /bin/zsh

                and that would start zsh as your interactive shell, but I don't know
                whether the behavior would be the same as if you executed ":sh" with
                sh=zsh.

                Regards,
                Gary

                --
                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
              • ranousse@gmx.com
                ... My problem with #!/bin/bash and #!/bin/sh is solved. Actually it did not concerned wich shell is used to run the script but the syntax highlighting. I have
                Message 7 of 18 , Aug 1, 2011
                • 0 Attachment
                  On 31/07 13:10, Gary Johnson wrote:
                  > I'm not sure I understand the problem. If you write your shell
                  > scripts with
                  >
                  > #!/bin/bash
                  >
                  > as the first line, they will be executed by bash, regardless of the
                  > shell they were started from.

                  My problem with #!/bin/bash and #!/bin/sh is solved. Actually it did not
                  concerned wich shell is used to run the script but the syntax
                  highlighting. I have no problem about wich shell is used to run the
                  script.

                  My question about which shell is used between bash and zsh concerns
                  :!shell_cmd and :sh.
                  In the first case
                  I would like like that :!shell_cmd is runed with bash.
                  (In fact the main reason is that sometimes I write things like
                  :!action="xpdf -option"; ...; $action file
                  and by default zsh does not split $action in 2 strings, there's an
                  option but it needs one more command).

                  And for :sh, as it's a classical interactive shell, I would prefer zsh.

                  > What behavior do you want from
                  >
                  > :!shell_command
                  >
                  > that you get from bash that you don't get from zsh?
                  > You could create a ~/.bashrc that contains just
                  >
                  > exec /bin/zsh
                  >
                  > and that would start zsh as your interactive shell, but I don't know
                  > whether the behavior would be the same as if you executed ":sh" with
                  > sh=zsh.

                  This seems to work. But I loose the possibility of running interactive
                  bash if I want. Interesting however.

                  --
                  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 12:31:16 01 August 2011, Monday ... You can put this option somewher in ~/.zshenv. Or, better, use
                  Message 8 of 18 , Aug 1, 2011
                  • 0 Attachment
                    Reply to message «Re: sh vs bash syntax coloring»,
                    sent 12:31:16 01 August 2011, Monday
                    by ranousse@...:

                    > In the first case
                    > I would like like that :!shell_cmd is runed with bash.
                    > (In fact the main reason is that sometimes I write things like
                    >
                    > :!action="xpdf -option"; ...; $action file
                    >
                    > and by default zsh does not split $action in 2 strings, there's an
                    > option but it needs one more command).
                    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.

                    Original message:
                    > On 31/07 13:10, Gary Johnson wrote:
                    > > I'm not sure I understand the problem. If you write your shell
                    > > scripts with
                    > >
                    > > #!/bin/bash
                    > >
                    > > as the first line, they will be executed by bash, regardless of the
                    > > shell they were started from.
                    >
                    > My problem with #!/bin/bash and #!/bin/sh is solved. Actually it did not
                    > concerned wich shell is used to run the script but the syntax
                    > highlighting. I have no problem about wich shell is used to run the
                    > script.
                    >
                    > My question about which shell is used between bash and zsh concerns
                    >
                    > :!shell_cmd and :sh.
                    >
                    > In the first case
                    > I would like like that :!shell_cmd is runed with bash.
                    > (In fact the main reason is that sometimes I write things like
                    >
                    > :!action="xpdf -option"; ...; $action file
                    >
                    > and by default zsh does not split $action in 2 strings, there's an
                    > option but it needs one more command).
                    >
                    > And for :sh, as it's a classical interactive shell, I would prefer zsh.
                    >
                    > > What behavior do you want from
                    > >
                    > > :!shell_command
                    > >
                    > > that you get from bash that you don't get from zsh?
                    > > You could create a ~/.bashrc that contains just
                    > >
                    > > exec /bin/zsh
                    > >
                    > > and that would start zsh as your interactive shell, but I don't know
                    > > whether the behavior would be the same as if you executed ":sh" with
                    > > sh=zsh.
                    >
                    > This seems to work. But I loose the possibility of running interactive
                    > bash if I want. Interesting however.
                  • ranousse@gmx.com
                    ... 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
                    Message 9 of 18 , Aug 1, 2011
                    • 0 Attachment
                      > 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
                    • 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 10 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
                      • Benjamin R. Haskell
                        ... Yes, they are: http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html $(command) - #tag_02_06_03 - command substitution $((n+1)) -
                        Message 11 of 18 , Aug 1, 2011
                        • 0 Attachment
                          On Sun, 31 Jul 2011, Thilo Six wrote:

                          > ranousse@... wrote the following on 31.07.2011 12:42
                          >
                          > Hello
                          >
                          >> I'm not very happy with syntax coloring of sh scripts (starting with
                          >> #!/bin/sh). For example, things like $(command), $((n+1)) or
                          >> ${var%.txt} are very badly displayed. However they are part of POSIX
                          >> sh I think.

                          Yes, they are:

                          http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
                          $(command) - #tag_02_06_03 - command substitution
                          $((n+1)) - #tag_02_06_04 - arithmetic expansion
                          ${var%.txt} - #tag_02_06_02 (last ¶) - parameter expansion


                          >> Do you know a simple hack to correct this. Something that could
                          >> interest me would be always using bash syntax coloring even with
                          >> #!/bin/sh at the beginning.
                          >>
                          >> I thought of modelines but vim seems to use the same syntax file for
                          >> sh and bash and thus I cannot use something like
                          >> # vi: syntax=bash
                          >> or
                          >> # vi: ft=bash
                          >>
                          >
                          >
                          > ,----[ :h ft-sh-syntax ]----------------------
                          >
                          > < bash: >
                          > let g:is_bash = 1
                          > `---------------------------------------------

                          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?

                          --
                          Best,
                          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
                          ... Just to be complete, please read :help ft-syntax-sh (g:is_bash is covered there, for example). Regards, Chip Campbell -- You received this message from
                          Message 12 of 18 , Aug 1, 2011
                          • 0 Attachment
                            ranousse@... wrote:
                            > On 31/07 13:49, Thilo Six wrote:
                            >
                            >> ,----[ :h ft-sh-syntax ]----------------------
                            >>
                            >> < bash:>
                            >> let g:is_bash = 1
                            >> `---------------------------------------------
                            >>
                            > So there is no trick at all, I only have to choose the right option.
                            > Thank you very much.
                            >
                            Just to be complete, please read :help ft-syntax-sh (g:is_bash is
                            covered there, for example).

                            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
                          • 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 13 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 14 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 15 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 16 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 17 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 18 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.