(Obscure) problem with bash syntax highlighting

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

(Obscure) problem with bash syntax highlighting

J S-3
bash allows (yes, it is a "bashism") syntax like:

$ echo ${var:9:5}

To mean extract a substring of the variable, starting at position 9 and of length 5.

But is also allows the offset (and then length, too, but ignore that for now) to be
negative.  But, alas, as noted in "man bash", if the offset is negative, you have to
put a space after the :, in order to avoid ambiguity with the usual ${var:-xxx}
construct.  So, you have to write:

$ echo ${var: -9:5}

Alas, vim flags this as an error.  If I take out the space before the -, the
highlighting is OK.  But with the space, it is flagged as error.

Can this be fixed?

Note: I tried contacting the listed author/maintainer (Charles Campbell) via email first (before posting this), but the mail bounced.  It looks like the sh.vim file hasn't been updated since 2014.

Note also: This was tested under VIM 7.4 (which is what I use).  If it has been fixed in a later version, please let me know.

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/989099977.5724019.1558469869750%40mail.yahoo.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: (Obscure) problem with bash syntax highlighting

L. A. Walsh
--
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
----
ok, though isn't it more important to prune unnecessary content?
:-|



On 2019/05/21 13:17, 'J S' via vim_use wrote:

> But is also allows the offset (and then length, too, but ignore that
> for now) to be negative.  But, alas, as noted in "man bash", if the
> offset is negative, you have to
> put a space after the :, in order to avoid ambiguity with the usual
> ${var:-xxx} construct.  So, you have to write:
>
> $ echo ${var: -9:5}
>
> Alas, vim flags this as an error.  If I take out the space before the
> -, the highlighting is OK.  But with the space, it is flagged as error.
>
> Can this be fixed?
Not that it fixes the syntax, but I've always used "${var:0-9:5}" so the
field
would clearly stand out as starting with an integer and not the ambiguous
'dash'.  Is that flagged as an error too?

Just curious....

-l

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/5CE8295A.80606%40tlinx.org.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: (Obscure) problem with bash syntax highlighting

Tony Mechelynck
In reply to this post by J S-3
On Fri, May 24, 2019 at 1:52 PM 'J S' via vim_use
<[hidden email]> wrote:
[...]
> Note: I tried contacting the listed author/maintainer (Charles Campbell) via email first (before posting this), but the mail bounced.  It looks like the sh.vim file hasn't been updated since 2014.

Dr. Chip's adress is listed in $VIMRUNTIME/syntax/sh.vim as:

" Maintainer:        Charles E. Campbell  <[hidden email]>

which is intentionally obfuscated to avoid spamming. Remove the
letters making up NOSPAM to get his actual email address.

Best regards,
Tony.

--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXsA2qnLSSpGzcFw0dkdGPznOhHP7ur2dAax%2BfPYaf%3D_Tw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: (Obscure) problem with bash syntax highlighting

Gary Johnson-4
On 2019-05-24, Tony Mechelynck wrote:

> On Fri, May 24, 2019 at 1:52 PM 'J S' via vim_use
> <[hidden email]> wrote:
> [...]
> > Note: I tried contacting the listed author/maintainer (Charles
> > Campbell) via email first (before posting this), but the mail
> > bounced.  It looks like the sh.vim file hasn't been updated
> > since 2014.
>
> Dr. Chip's adress is listed in $VIMRUNTIME/syntax/sh.vim as:
>
> " Maintainer:        Charles E. Campbell  <[hidden email]>
>
> which is intentionally obfuscated to avoid spamming. Remove the
> letters making up NOSPAM to get his actual email address.

Also, the latest version (as of 8.1.1200) in $VIMRUNTIME/syntax is
version 186, last changed on March 26, 2019.

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190524190749.GB24449%40phoenix.
For more options, visit https://groups.google.com/d/optout.