lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sat, May 14, 2011 at 12:15 PM, Peter Odding <peter@peterodding.com> wrote:
>> So I went ahead and implemented that little command line utility. I
>> think it is better to isolate the core file filtering from the vim
>> plugin. I might be able to use vim's lua interface to code the plugin,
>> but maybe it will be better to use plain old vimscript and call the
>> external utility. Not sure yet.
>
> If your command line utility uses print() to report its results, you can
> intercept the output of the script when executed using the Lua Interface
> for Vim using Vim's :redir command.
>
> I'm attaching two files, a Vim plug-in and a Lua module. The plug-in
> will call the module using the Lua Interface for Vim if available, but
> fall back to executing an external Lua interpreter process. Here's a
> usage example of how you can call the function defined by the plug-in
> (just type this into Vim).
>
>  :call confirm(InvokeLua('myluamod', "Vim calls Lua"))
>
>  - Peter Odding
>
> PS. When the Lua Interface for Vim encounters a syntax error or similar
> while loading the Lua module, the require() call will return false and
> keep doing so (very annoying) unless you execute the following in Vim:
>
>  :lua package.loaded.myluamod = nil

Thanks Peter, this looks quite useful


-- 
--------------------------------------------------------------
EmmanuelOga.com - Software Developer