Can I add (embed) Vim option settings to the contents of a file?

You can use modelines to add Vim option settings to the contents of a file. For example, in a C file, you can add the following line to the top or the bottom of the file:

    /* vim:sw=4: */

This will set the ‘shiftwidth’ option to 4, when editing that C file. For this to work, the ‘modeline’ option should be set. By default, the ‘modeline’ option is set. An alternative example is given in this document in the first line. The ‘modelines’ settings specifies the number of lines that will be checked for the Vim set commands.

Comments (1)


Pepsh Pepshinsky

Let’s see you to :help viminfo-file-name (option -i) :set viminfofile=NONE


Speak Your Mind