What is Vim's feature name for this: # vim:sw=4:ts=4:et:

不羁岁月 提交于 2020-01-01 04:25:08

问题


It does not work for me and I would like to review my configuration. Maybe I turned it off globally. But I don't know what actually to google for :-) Thanks.

# vim:sw=4:ts=4:et: 

回答1:


It's called modeline

: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)

Add this to $MYVIMRC:

setglobal modeline



回答2:


It's called modeline. In help it can be found by grepping

helpgrep # vim

If you wish to check whether modeline are active, do set modeline? (if the are it will say modeline, otherwise nomodeline)

To turn them off for certain, add this in your vimrc

:set modelines=0 "number of modelines vim parses
:set nomodeline "turn off parsing



回答3:


:h 'ts (i.e. :help 'tabstop') will bring up a detailed explanation of how to use et, ts, and sw as well as giving a pointer to modeline (modeline is the option that is in question).



来源:https://stackoverflow.com/questions/7119824/what-is-vims-feature-name-for-this-vimsw-4ts-4et

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!