dustinblackman / oatmeal.nvim

Terminal UI to chat with large language models (LLM) using different model backends, and with a plugin for Neovim!
https://github.com/dustinblackman/oatmeal
MIT License
82 stars 3 forks source link

I getting an error try to run the Oatmeal command #9

Closed jim-at-jibba closed 8 months ago

jim-at-jibba commented 8 months ago

Hey,

Thanks for the plugin its just what I am looking for. I love the TUI.

Im running this version of Neovim

Screenshot 2024-01-28 at 06 33 24

I am struggling to run it in Neovim though. I just get the following error when I run the command.

  '<,'>Oatmeal Error executing Lua callback: ...vim-minimal/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:48: Vim:Error executing Lua callback: ...cal/share/nvim-minimal/lazy/oatmeal.nvim/lua/oatmeal.lua:15: attempt to call field 'in_visual_mode' (a nil value)
stack traceback:
    ...cal/share/nvim-minimal/lazy/oatmeal.nvim/lua/oatmeal.lua:15: in function 'set_context'
    ...cal/share/nvim-minimal/lazy/oatmeal.nvim/lua/oatmeal.lua:87: in function <...cal/share/nvim-minimal/lazy/oatmeal.nvim/lua/oatmeal.lua:86>
    [C]: in function 'cmd'
    ...vim-minimal/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:48: in function <...vim-minimal/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:16>
stack traceback:
    [C]: in function 'cmd'
    ...vim-minimal/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:48: in function <...vim-minimal/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:16>
Screenshot 2024-01-28 at 06 32 20

Let me know if there is anything you need. Thanks

dustinblackman commented 8 months ago

Hey there! Thanks for reporting!

That one looks weird, seems to be related to highlighting. Could you walk me through what you had been trying to do? Did you selects a few lines, hit :, and entered Oatmeal? Or did you use the hotkey?

jim-at-jibba commented 8 months ago

Hey,

Thanks for the speedy reply.

This happens when I make a selection and when I dont. Just trying to run the Oatmeal command with :. I will try with my minimal setup and see if its a problem my end

jim-at-jibba commented 8 months ago

Looks like it is an issue with my config. I will start to remove the likely culprits. Will report back when I know what it just in case others have the same issue

Sorry for wasting your time

jim-at-jibba commented 8 months ago

Its so strange, just cant get it to work. Works fine in bare bones init.lua but even when I take everything out of my config I get this error.

Will close its its not your issue. Thanks

dustinblackman commented 8 months ago

Lemme know if you come across the issue! I'd be down to add it to the docs incase other users run in to it.

Loungagna commented 7 months ago

I have the same issue. `NVIM v0.9.5 Build type: Release LuaJIT 2.1.1703358377

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.5/share/nvim"

Run :checkhealth for more info`

when calling Oatmeal, the notification shows: Error executing Lua callback: ...cois/.local/share/nvim/lazy/oatmeal.nvim/lua/oatmeal.lua:15: attempt to call field 'in_visual_mode' (a nil value) stack traceback: ...cois/.local/share/nvim/lazy/oatmeal.nvim/lua/oatmeal.lua:15: in function 'set_context' ...cois/.local/share/nvim/lazy/oatmeal.nvim/lua/oatmeal.lua:87: in function <...cois/.local/share/nvim/lazy/oatmeal.nvim/lua/oatmeal.lua:86>

mdietrich16 commented 7 months ago

Is this because a user configuration shadows utils.lua? The error states that in_visual_mode can't be found, which is a member of utils.lua, which I also have in my personal config. Maybe that is earlier on the Lua path, so the plugins utils.lua does not get loaded and used here?

mdietrich16 commented 7 months ago

Yup, seems like it. I just put all oatmeal.nvim files into another namespace (moved everything under lua/ to lua/oatmeal/ and changed the paths in the source files and voila, it works.

dustinblackman commented 7 months ago

Ah, so I've built the folder structure incorrectly?

mdietrich16 commented 7 months ago

Well, not incorrectly per se, but it would probably be wise to properly namespace the modules. I'm not sure how plugins usually do this, what I did was just what first came to mind.

Loungagna commented 7 months ago

So what should I do? Move any folder around? change my config files? Wait for the PR?

mdietrich16 commented 7 months ago

Well, I can do a PR, but this doesn't require any new code and is essentially a matter of taste, how and where to put the files. You could fix it yourself by renaming your own (presumambly named) utils.lua to something else (or move it into a namespace user.utils for example) and changing references to that in your code. But I think it should be fixed in this plugin, since others might have the same problem then. So, I'll wait for a commit (or do a PR later).

dustinblackman commented 7 months ago

Makes sense! I'll happily accept a PR :) I appreciate it!