vim - 这个 : # vim:sw=4:ts=4:et: 的 Vim 功能名称是什么

标签 vim

即使在使用 Vim 20 年后,我仍然忘记了 Vim 功能的名称,其中编辑器从文件开头(或我认为结尾)的注释中选取配置语句:

# vim:sw=4:ts=4:et:
谢谢提醒!

最佳答案

它被称为模式线

:he modeline

If you start editing a new file, and the 'modeline' option is on, a number of lines at the beginning and end of the file are checked for modelines. 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)

将此添加到 $MYVIMRC:
setglobal modeline

关于vim - 这个 : # vim:sw=4:ts=4:et: 的 Vim 功能名称是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7119824/

相关文章:

vim - 如何查看特定 go 函数的文档?

java - 在Vim中,如何在/src/中编译.java文件并从/bin/运行其类文件?

vim - 如何通过boost减少clang_complete搜索的时间

c++ - Vim YouCompleteMe 配置

regex - Vim 正则表达式搜索 : alter placement of cursor in matched strings

命令模式下的 vim 路径补全

Vim 不按空格缩进

java - Vim,Java : Open class under cursor and go to method

vim - gvim 长多行字符串高亮

vim - 在启用 set mouse=a 的情况下在 Vim 外部复制文本