Discrepancy between modeline help and behavior

17 views
Skip to first unread message

Gary Johnson

unread,
Dec 5, 2019, 9:51:35 PM12/5/19
to vim...@googlegroups.com
":help modeline" says:

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)

Note that the initial white space is not optional. However, that
initial white space is not actually required. For example, create
a file containing only the line

vim: tw=40

left justified, open it with

$ vim -N -u NONE demo

and execute:

:verbose set tw?
textwidth=40
Last set from modeline line 1

I don't particularly care whether the documentation or the behavior
is changed, but one should be to match the other.

I tested this using 8.1.2397.

Regards,
Gary

Andy Massimino

unread,
Dec 5, 2019, 9:55:34 PM12/5/19
to vim...@googlegroups.com
It says a little further down "There is one exception:" that the whitespace is optional if v is the first character on the line.  

--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/20191206025128.GA25379%40phoenix.

Bram Moolenaar

unread,
Dec 6, 2019, 9:28:19 AM12/6/19
to vim...@googlegroups.com, Gary Johnson
I think it should be:

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

[text{white}] empty or any text followed by at least one blank
character (<Space> or <Tab>); "ex:" always requires at
least one blank character

The exception further down is hard to spot.

--
hundred-and-one symptoms of being an internet addict:
199. You read this entire list of symptoms, looking for something
that doesn't describe you.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages