On 20/05/09 20:48, Linda W wrote:
>
>
> Sometimes I create/change modelines on the fly as a I create or
> modify a file and want to see the results of my changes w/o saving
> (or exiting/re-entering).
>
> Why don't simple modelines work in 'set'?
>
> i.e. I often have trivial tabs-setup modelines I add at the end
> of a new file, like:
>
> : vim:ts=4:sw=4:si
> or in text
> : vim:et:sts=4:sw=4:nosi:ai
> ...etc.
>
> What I'd like to do is type
> :set ts=4:sw=4:si
>
> But I get an 'invalid argument'.
>
> Is there a reason why the multi-set syntax is prohibited/disabled during
> interactive input mode? Is there a flag to enable it?
>
>
>
> Thanks,
> -linda
Part of this has already been answered, but I think I can still
contribute something. Sorry for being late reading email.
1) As has already been said, when typing at the command-line, the
separator between multiple options in the ":set" command (and friends)
is whitespace, not a colon.
2) Modelines are always local to the file which contains them. NO other
file is affected, and the global defaults for new files created in the
future are also not affected. Unless... you happen to use a global-only
option (such as 'encoding' or 'guifont') in a modeline, something which
is NOT recommended even if it sometimes works.
So, to see the effect of
: vim:et:sts=4:sw=4:nosi:ai
what you should do is either
:setlocal et sts=4 sw=4 nosi ai
(with ":setlocal", not plain ":set", and with spaces, not colons) or
:up|e
The latter (write if modified, then reload) looks simpler to me, and
more general (it's the same regardless of how you changed your modeline,
so it's easy to create a mapping for it), but of course it's exactly
what you wanted not to do. So -- I suppose YMMV.
Alternately, you could use the second form of modelines: e.g. in a C
source file:
/* vim: set et sts=4 sw=4 nosi ai :*/
then (for instance) yank the text between the two colons (excluded), hit
the colon key to go to command-line mode, then Ctrl-R double-quote to
insert the yanked text, and then edit the command line to change :set
into :setl before you hit Enter. Or yank only the part after the ":set"
in the modeline, and type ":setl " (without the quotes of course) by
hand before inserting the yanked text.
Best regards,
Tony.
--
While most peoples' opinions change, the conviction of their
correctness never does.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---