Monday, August 1, 2011

Re: sh vs bash syntax coloring

On Sun, 31 Jul 2011, Thilo Six wrote:

> ranousse@gmx.com 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

No comments: