On 06/12/08 00:29, Marc Weber wrote:
> Thinking about TOVL I'm faced by a problem:
> I'd like to expose the configuration, so that the user can customize it
> easily.
> A perfect fit would be just let the user edit or customize the code
> snippet then run it in the right context using exec. But exec is
> limited, isn't it?
>
> Example:
> exec "echo \"foo\"\n\\.'bar'"
>
> This is this script:
> echo "foo"
> \.'bar'
>
> it should echo foobar.
>
> A use case would by TOVL:
>
> let d = NewPlugin()
>
> fun d.PluginLoad()
> exec "user config"
> endfun
>
> Marc
To run a separate script, use ":source" (q.v.), not ":exec".
The command
:exec "user config"
would execute the hypothetical command
:user config
but of course the ":user" command does not exist, so you get an error.
What ":exec" does is executing as an ex-command what ":echo" would have
displayed, given the same arguments. Notice that when you type an
ex-command at the command-line, Vim executes it as soon as you hit
<Enter> without waiting to see if you'll type zero or more whitespace
characters followed by a backslash.
Best regards,
Tony.
--
TALL KNIGHT: We shall say Ni! again to you if you do not appease us.
ARTHUR: All right! What do you want?
TALL KNIGHT: We want ... a shrubbery!
"Monty Python and the Holy Grail" PYTHON (MONTY)
PICTURES LTD
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---