Weyaaron / nvim-training

A plugin to practice neovim movements, currently in "open beta"
GNU General Public License v3.0
36 stars 3 forks source link

[Bug]: Unable to start #30

Closed windowsrefund closed 1 month ago

windowsrefund commented 1 month ago

Describe the bug

:Training Start
Error executing Lua callback: ...re/nvim/lazy/nvim-training/lua/nvim-training/utility.
lua:355: attempt to index local 'file' (a nil value)
stack traceback:
        ...re/nvim/lazy/nvim-training/lua/nvim-training/utility.lua:355: in function '
apppend_table_to_path'
        ...im-training/lua/nvim-training/commands/command_start.lua:147: in function '
execute'
        ...l/share/nvim/lazy/nvim-training/plugin/nvim-training.lua:16: in function <.
..l/share/nvim/lazy/nvim-training/plugin/nvim-training.lua:7>

How to reproduce the behavior

See above

Expected behavior.

Expected to start

Logs and Stack traces

No response

Screenshots

No response

Additional Context

No response

Environment

nvim --version
NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1713484068
cameronr commented 1 month ago

@windowsrefund it looks like there are some bugs in the recent refactor. if you disable events, it should work:

return {
  'Weyaaron/nvim-training',
  config = function()
    require('nvim-training').configure({
      enable_events = false,
    })
  end,
}

@Weyaaron I noticed a few quick things:

  1. It looks like there are some hard-coded references to /home/aaron in markdown.lua and user_config.lua.
  2. I think the underlying bug happens because the events directory doesn't get created (even if the hard-coded reference is replaced) before a file is tried to be opened in it. i.e. command_start.lua:147 happens before the call to init. I didn't trace any farther, so it's possible there are other things going on.
  3. Not related to the bug, but is there a reason for having the setup function be called configure instead of setup? Using configure means you can't use Lazy's opts way to specify the config
Weyaaron commented 1 month ago

Hi @cameronr and @windowsrefund , thanks for reporting this. I agree that the hardcoded references should be removed and I will publish a fix soonish. Regarding the configure vs setup: I will look into this and report back.