Tuesday, August 2, 2011

Re: sh vs bash syntax coloring

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

No comments: