vim-lua-ftplugin icon indicating copy to clipboard operation
vim-lua-ftplugin copied to clipboard

making it work with torch

Open kwon-young opened this issue 9 years ago • 2 comments

Hi, I would like to use this plugin with the framework torch. For now, i installed the plugin with vim-plug and the plugin doesn't seem to work well. After rapidly reading the doc, i set these settings in my vimrc:

let g:lua_interpreter_path = '/home/username/torch/install/bin/qlua'
let g:lua_internal = 0
let g:lua_complete_omni = 1

Torch installation embed a custom lua interpreter, however i'm a new to lua so i don't really know how to configure the plugin to make things work.

When i try the omni completion, i have the following error:

E121: Undefined Variable: Torch

Also the gf mapping doesn't really work

kwon-young avatar Feb 16 '16 09:02 kwon-young

Hi @kwon-young ,

I would really love to use this plugin with Torch as well. I can reproduce your error with a fresh install of Torch. After digging around a bit, I think the problem is happening in

https://github.com/xolox/vim-lua-ftplugin/blob/master/autoload/xolox/lua.vim#L447

Namely, the returned output list variable has two elements that are:

Torch 7.0  Copyright (C) 2001-2011 Idiap, NEC Labs, NYU
Torch 7.0  Copyright (C) 2001-2011 Idiap, NEC Labs, NYU

Then, these two lines are passed to the eval call and we end up with the Undefined Variable: Torch error.

@xolox do you have any pointers on how we can debug this further?

Edit: Ah ok! I think I know what is happening. This vimscript takes as output everything that is printed by omnicomplete.lua. However, one of the Torch scripts prints Torch 7.0 ... to stdout when included.

vzhong avatar May 14 '16 00:05 vzhong

So, this plugin works if you comment out the print statement in the beginning of ~/torch/install/share/lua/5.1/env/init.lua (your path will likely vary).

vzhong avatar May 14 '16 00:05 vzhong