在.vimrc的第一行中设置fdm = marker

时间:2014-12-22 01:21:47

标签: vim

这是我的.vimrc文件的第一行:

" vim:fdm=marker " Treat comments as folds

每当我编辑.vimrc时,我都会收到此错误(并且没有其他错误):

"~/.vimrc" 409L, 12674C
Error detected while processing modelines:
line    1:
E518: Unknown option: " 

由于我从其他.vimrc开始使用此行,因此它也适用于我的设置。为什么不呢?我该如何解决这个问题?

1 个答案:

答案 0 :(得分:4)

modeline语法错误。我怀疑它在你复制它的vimrc中是否有效。如果您阅读:h modeline,您会发现模式行正在尝试将第二个引号解释为选项。由于没有名为quote的选项,因此失败。

如果您想在模式行之后发表评论并获得类似以下内容的

,则应使用第二种模式行语法
" vim: set fdm=marker: " Treat comments as folds

:h modeline复制如下。

                                        modeline vim: vi: ex: E520
There are two forms of modelines.  The first form:
        [text]{white}{vi:|vim:|ex:}[white]{options}

[text]                  any text or empty
{white}                 at least one blank character (<Space> or <Tab>)
{vi:|vim:|ex:}          the string "vi:", "vim:" or "ex:"
[white]                 optional white space
{options}               a list of option settings, separated with white space
                        or ':', where each part between ':' is the argument
                        for a ":set" command (can be empty)

Examples:
   vi:noai:sw=3 ts=6
   vim: tw=77

The second form (this is compatible with some versions of Vi):

        [text]{white}{vi:|vim:|Vim:|ex:}[white]se[t] {options}:[text]

[text]                  any text or empty
{white}                 at least one blank character (<Space> or <Tab>)
{vi:|vim:|Vim:|ex:}     the string "vi:", "vim:", "Vim:" or "ex:"
[white]                 optional white space
se[t]                   the string "set " or "se " (note the space); When
                        "Vim" is used it must be "set".
{options}               a list of options, separated with white space, which
                        is the argument for a ":set" command
:                       a colon
[text]                  any text or empty