m00qek / baleia.nvim

Colorize text with ANSI escape sequences (8, 16, 256 or TrueColor)
138 stars 5 forks source link

module 'baleia' not found #4

Closed Sangdol closed 2 years ago

Sangdol commented 2 years ago

Hello,

I'm trying Conjure for Clojure and found this plugin in the Ansi Color thread (link).

I installed Baleia with Plug

  Plug 'm00qek/baleia.nvim', { 'tag': 'v1.1.0' }
  let g:conjure#log#strip_ansi_escape_sequences_line_limit = 0
  let s:baleia = luaeval("require('baleia').setup { line_starts_at = 3 }")
  autocmd BufWinEnter conjure-log-* call s:baleia.automatically(bufnr('%'))

but I faced an errer while running this luaeval("require('baleia').setup { line_starts_at = 3 }")

E5108: Error executing lua [string "luaeval()"]:1: module 'baleia' not found:
        no field package.preload['baleia']
        no file './baleia.lua'
        no file '/usr/local/Cellar/luajit-openresty/2.1-20211210/share/luajit-2.1.0-beta3/baleia.lua'
        no file '/usr/local/share/lua/5.1/baleia.lua'
        no file '/usr/local/share/lua/5.1/baleia/init.lua'
        no file '/usr/local/Cellar/luajit-openresty/2.1-20211210/share/lua/5.1/baleia.lua'
        no file '/usr/local/Cellar/luajit-openresty/2.1-20211210/share/lua/5.1/baleia/init.lua'
        no file './baleia.so'
        no file '/usr/local/lib/lua/5.1/baleia.so'
        no file '/usr/local/Cellar/luajit-openresty/2.1-20211210/lib/lua/5.1/baleia.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'require'
        [string "luaeval()"]:1: in main chunk

It seems luaeval can't find baleia. How could I fix this?

Thanks.

m00qek commented 2 years ago

Hey 👋🏽 Are you sure that plug installed Baleia properly?

Sangdol commented 2 years ago

Hi, yes I've checked it out and even tried to copy the installed Baleia to other folders to see if it works. Does it work well with Plug on your side? After reading the lua-require section I wasn't sure if it could load a file in a custom plug folder which is ~/.vim/plugged in my case.

m00qek commented 2 years ago

I don't use Plug myself. Are you calling Plug between call plug#begin() and call plug#end()?

Sangdol commented 2 years ago

Hey,

I've found out the reason for the issue. I have to load a lua module after call plug#end() since the plug#end() function updates &runtimepath.

The problem was that I was calling this function right after the Plug 'm00qek/baleia.nvim', { 'tag': 'v1.1.0' } line like this:

Plug 'm00qek/baleia.nvim', { 'tag': 'v1.1.0' }
let s:baleia = luaeval("require('baleia').setup { }")

I'm closing the issue.

Thanks for your support.