thanks very much.
skyworld On Jan 6, 11:29 am, Tony Mechelynck <[email protected]> wrote: > On 06/01/13 03:25, skyworld wrote: > > > > > > > Hi Tim & Tony, > > > thanks for your kind reply. After reading the help, I still have a > > question on this: > > > the help has two examples on this: > > a) Example: > > vi:noai:sw=3 ts=6 > > b) Example: > > /* vim: set ai tw=75: */ > > and in my code: > > c) # vim:et:sw=4:ts=4:ft=python: > > > Since these three examples has different formats at beginning (i.e, /* > > or # or ""), I guess the vim modeline settings should be "put" after > > the comments of the line, and this comment maybe different, e.g, if > > you are using C, it should be put behind /*; and if you are using > > shell/perl/python, it should be put behind "#". And this comment > > should be put at the end of the file. Do I understand this correct? > > thanks. > > > Skyworld > > The comment should be put within 'modelines' lines (usually 5 lines) of > the beginning *or* end of the file, your choice. It will only work if > 'modeline' (in the singular) is on, which is the default provided that > you're running Vim in 'nocompatible' mode and not in the root (i.e. > sysadmin) login account. > > When using C with /* and */, you should use the second form (with "set") > because the other one goes on till the end of the line. Similarly for > HTML or XML with <!-- and -->. In the case of HTML you may prefer to put > the modeline near the top of the file, immediately after the <head> > opening tag. OTOH for C++ or javascript or CSS you can use a // comment > and that needs no closing boundary other than the end of the line, so in > that case a modeline of the first form (with colons and no "set") is > acceptable. > > And yes, how the comment is written depends on the programming language: > # in (for instance) a shell script, a double-quote character in a Vim > script, and I gave other examples in the above paragraph. > > Best regards, > Tony. > -- > If little else, the brain is an educational toy. > -- Tom Robbins- Hide quoted text - > > - Show quoted text - -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
