【问题标题】:VIM comment hashtag error?VIM 评论标签错误?
【发布时间】:2013-10-24 22:44:44
【问题描述】:

我认为像 vim 这样的文本编辑器使用 # 来表示注释并跳过这些行。

这是我的 ~/.vimrc 文件的内容:

# Testing comments
set nocompatible

# Testing comments
set number

但是当我运行 vim 时,我得到了这个:

处理 /home/user/.vimrc 时检测到错误:

line 1:
E488: Trailing characters: # Testing comments
line 4:
E488: Trailing characters: # Testing comments

当我删除注释行时,它可以正常工作,但我希望能够将 cmets 添加到我的文本文件中,而不会弄乱。有谁知道我做错了什么?

另外,我读到我不应该使用“””,因为这并不是真正的评论。这也适用于块。

【问题讨论】:

    标签: python vim comments hashtag


    【解决方案1】:

    vim 不将# 用于 cmets;它使用引号。你的.vimrc 应该是

    " Testing comments
    set nocompatible
    
    " Testing comments
    set number
    

    根据您对 """ 的评论,您似乎将 Python cmets 与 Vim cmets 混淆了。

    【讨论】:

    • "将 Python cmets 与 Vim cmets 混淆" ...更不用说将 Python 字符串与 Python cmets 混淆了。
    • 当有人在他们的 vimrc 中使用来自 this question 的 hash cmets 时,我真的很困惑。感谢您清除它。
    【解决方案2】:

    在 .vimrc 中编写你必须使用的 cmets " 你的文件看起来像

    " Testing comments
    set nocompatible
    
    " Testing comments
    set number
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-30
      • 2017-06-14
      • 1970-01-01
      • 2014-08-27
      • 2021-12-04
      • 2015-08-17
      相关资源
      最近更新 更多