On Wed, Jul 17, 2013 at 3:09 PM, Adnan Zafar <[email protected]> wrote:
> On Wed, Jul 17, 2013 at 4:02 PM, Peng Yu <[email protected]> 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

The following is the document from bash. I don't see the usage of
\EOF. Do you know where it is documented? I tried both \EOF and EOF,
both of them generate the same dvi file. So it seems \r and \e are
take literally by tex (i.e., a backslash and 'r', a backslash and
'e'). Is it so?

   Here Documents
       This type of redirection instructs the shell to  read  input  from  the
       current source until a line containing only delimiter (with no trailing
       blanks) is seen.  All of the lines read up to that point are then  used
       as the standard input for a command.

       The format of here-documents is:

              <<[-]word
                      here-document
              delimiter

       No  parameter expansion, command substitution, arithmetic expansion, or
       pathname expansion is performed on word.  If any characters in word are
       quoted,  the  delimiter is the result of quote removal on word, and the
       lines in the here-document are not expanded.  If word is unquoted,  all
       lines  of  the here-document are subjected to parameter expansion, com-
       mand substitution, and arithmetic expansion.  In the latter  case,  the
       character  sequence  \<newline> is ignored, and \ must be used to quote
       the characters \, $, and `.

       If the redirection operator is <<-, then all leading tab characters are
       stripped  from  input  lines  and  the line containing delimiter.  This
       allows here-documents within shell scripts to be indented in a  natural
       fashion.


-- 
Regards,
Peng

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to