由于双尖括号,Vim禁用语法高亮(Vim disables syntax highlighting because of double angle brackets)

编程入门 行业动态 更新时间:2024-10-18 03:22:06
由于双尖括号,Vim禁用语法高亮(Vim disables syntax highlighting because of double angle brackets)

我试图在我的shell脚本中使用此示例

#!/bin/sh HOST='ftp.users.qwest.net' USER='yourid' PASSWD='yourpw' FILE='file.txt' ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD put $FILE quit END_SCRIPT #### My code # #

但由于<<END_SCRIPT ,vim没有语法突出显示超出该行的任何内容。 我正在使用red hat linux 5 Source for code snippet http://www.stratigery.com/scripting.ftp.html

编辑:可能是我的问题不明确。 Eveyone评论说vim无法突出heredocs。 但在heredoc之后我更关注代码。 我应该提到即使在heredoc结束后代码也不会突出显示。 弄清楚这是一个问题,因为END_SCRIPT应该从行的开头开始(中间没有空格)

I am trying to use this example in my shell script

#!/bin/sh HOST='ftp.users.qwest.net' USER='yourid' PASSWD='yourpw' FILE='file.txt' ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD put $FILE quit END_SCRIPT #### My code # #

But because of the <<END_SCRIPT , vim does not syntax highlights anything beyond that line. I am using red hat linux 5 Source for code snippet http://www.stratigery.com/scripting.ftp.html

EDIT: May be my question was not clear. Eveyone has commented about vim not being able to highlight heredocs. But I was more concern about the code after heredoc. I should have mentioned that code is not highlighted even after heredoc is ended. Figured out that it was a problem because there END_SCRIPT should start at the beginning of the line (no space in between).

最满意答案

从<<END_SCRIPT到行<<END_SCRIPT的下一个实例之后的行的区域是一个heredoc,它基本上是一个多行字符串文字。 vim强调它是这样的,因为heredoc可以诚实地只包含任意数据,并且没有好的方法让vim知道如何处理它开箱即用。

I already edited my question to mention how I resolved the issue. But mentioning it here as an answer to be consistent with the format.

The heredoc was not ended because I has space between the start of the line and "END_SCRIPT".

更多推荐

本文发布于:2023-07-04 17:12:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1026975.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:尖括号   语法   高亮   disables   Vim

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!