0

I’m trying to run Fennel scripts in Vim 8.1 using the fennel-nvim plugin. (Fennel is a language that basically lets you write Lua with LISP syntax; you can use it from any Lua-supporting application by dropping in a single Lua file.) The fennel-nvim package is obviously written with Neovim in mind, but I thought maybe it would be simple enough to get it working with Vim anyway.

I’m using the vim-plug plugin manager. When I add the line Plug 'jaawerth/fennel-nvim' to my vimrc, I get the following error when starting Vim:

Error detected while processing /home/bdesham/.vim/plugged/fennel-nvim/plugin/fnl.vim:
line    1:
[string "vim chunk"]:1: module 'patch_searcher' not found:
^Ino field package.preload['patch_searcher']
^Ino file '/usr/share/lua/5.2/patch_searcher.lua'
^Ino file '/usr/share/lua/5.2/patch_searcher/init.lua'
^Ino file '/usr/lib/lua/5.2/patch_searcher.lua'
^Ino file '/usr/lib/lua/5.2/patch_searcher/init.lua'
^Ino file './patch_searcher.lua'
^Ino file '/usr/lib/lua/5.2/patch_searcher.so'
^Ino file '/usr/lib/lua/5.2/loadall.so'
^Ino file './patch_searcher.so'
Press ENTER or type command to continue

The offending line is the first line of fnl.vim:

lua require("patch_searcher")()

The plugin does come with a file called patch_searcher.lua:

fennel-nvim
├── FENNEL-LICENSE
├── .gitignore
├── LICENSE
├── lua
│   ├── fennel.lua
│   ├── fennelview.lua
│   └── patch_searcher.lua
├── plugin
│   └── fnl.vim
└── README.md

It seems like I might be able to get this plugin to work with Vim if I can tell the embedded Lua interpreter to add this directory to its “search path,” or whatever this is called in Lua. How can I go about doing that?

  • Try something akin to the lua section in this qurstion. I don't know Lua so I can't vouch for it, but looks like that's a step in the right direction... If you make it work, post it as an answer here yourself. Good luck! – filbranden Jul 17 at 3:25
  • You can try lua require("../lua/patch_searcher")() – Alex Kroll Jul 18 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.