[20191130]vim modeline.txt
--//今天编辑文件,发现每次打开老是报错,提示类似如下:
处理 modelines 时发生错误:
第 3 行:
E518: 未知的选项: this
$ cat a.txt
for ex: this is a test
--//输入:help modeline,看到如下:
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 (
{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)
Example:
vi:noai:sw=3 ts=6 ~
The second form (this is compatible with some versions of Vi):
[text]{white}{vi:|vim:|ex:}[white]se[t] {options}:[text]
[text] any text or empty
{white} at least one blank character (
{vi:|vim:|ex:} the string "vi:", "vim:" or "ex:"
[white] optional white space
se[t] the string "set " or "se " (note the space)
{options} a list of options, separated with white space, which is the
argument for a ":set" command
: a colon
[text] any text or empty
Example:
/* vim: set ai tw=75: */
The white space before {vi:|vim:|ex:} is required. This minimizes the chance
that a normal word like "lex:" is caught. There is one exception: "vi:" and
"vim:" can also be at the start of the line (for compatibility with version
3.0). Using "ex:" at the start of the line will be ignored (this could be
short for "example:").
--//原来这种模式控制文件的显示模式以及设置,做一个记录.一般在开头以及结尾的5行.
--//一些开发会使用一些特殊的定义.
--//假设定义如下,打开文件就会在列10,20,40出现彩色的竖线
/* vim: set colorcolumn=10,20,40: */