Wednesday, July 17, 2013

Re: Incorrect syntax highlight of things like '\r' within EOF block in bash script

On 2013-07-17, Adnan Zafar wrote:
> On Wed, Jul 17, 2013 at 4:02 PM, Peng Yu wrote:
> > Hi,
> >
> > vim can not syntax highlight the following script correctly. Does
> > anybody know a better highlight plugin that can correct highlight it?
> > Thanks.
> >
> > ~/linux/test/latex/tex/bin$ cat main.sh
> > #!/usr/bin/env bash
> >
> > tex <<EOF
> > \relax
> > Hello?
> > \end
> > EOF
> >
> > --
> > Regards,
> > Peng
>
> Inside of heredocs, bash (and other shells) can do certain expansions
> and substutions, so the Vim syntax highlights for those. However if
> the delimiter word (here EOF) is quoted in some way, like \EOF then
> those expansions and substitutions are disabled, and Vim's syntax
> adjusts accordingly.
>
> In short either escape backslashes inside the heredoc or simply use
>
> tex << \EOF
> \relax
> Hello?
> \end
> EOF

Except that bash does not expand \r or \e in Peng's context.


$ od -bc <<EOF
\relax
Hello?
\end
EOF

0000000 134 162 145 154 141 170 012 110 145 154 154 157 077 012 134 145
\ r e l a x \n H e l l o ? \n \ e
0000020 156 144 012
n d \n
0000023


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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment