Monday, April 24, 2017

Re: an old "hack" of mine, shared for amusement

On 24.04.17 19:50, Eli the Bearded wrote:
> $ cat my-src/hacks/vi/fork
> vi: set noml | w! | ! vim % :
> vi: e! % | w! | q :
>
> foobar
> $
>
> I don't remember writing that, but I can fully believe I did. (There's
> other stuff there, I'm sure I have written.
>
> What this does is left as an exercise for the reader.

That is most interesting, as ":h modeline" describes that they comprise only
"set" directives, not arbitrary commands. I.e.:

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

after the:

{vi:|vim:|ex:} the string "vi:", "vim:" or "ex:"

It doesn't even allow the '|'.

How turning off modelines might help to execute commands in modelines is
a guessing game, without documentation of supported behaviour.

Admittedly, on the few occasions that an arbitrary command seemed to be
needed, I've found another way to achieve the result.

Erik

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: