August 14, 2010

Vim embedded command in the file edited

This is called "modeline" in vim. you can file help on that.

http://vim.wikia.com/wiki/Modeline_magic

First, make sure modeline is enabled. Then

The following examples show some alternatives that could be in a C file:

// vim: noai:ts=4:sw=4
-or-
/* vim: noai:ts=4:sw=4
*/
-or-
/* vim: set noai ts=4 sw=4: */
-or-
/* vim: set fdm=expr fde=getline(v\:lnum)=~'{'?'>1'\:'1': */

With "set", the modeline ends at the first colon not following a backslash. Without "set", no text can follow the options, so for example, the following is invalid:

Error E518: Unknown option: */

/* vim: noai:ts=4:sw=4 */

1 comment:

  1. Globalgeetha8/14/2010 6:39 AM

    This is the best resource for embedded system available on net, Thanx. Studentslike me can gain a lot from this.
    - emblitz.com

    ReplyDelete