natecraddock / workspaces.nvim

a simple plugin to manage workspace directories in neovim
MIT License
309 stars 15 forks source link

Cannot find util.path.sep in default configuration #9

Closed hatute closed 2 years ago

hatute commented 2 years ago

At first, thank you for this wonderful plugin, really appreciate it.

During my installation, I directly copied the configuration code from the "Installation" part. And this error emerged. I am new to lua. Could you give me any hints about this?

Error detected while processing /Users/swellmai/.config/nvim/init.lua: E5113: Error while calling lua chunk: .../swellmai/.config/nvim/lua/plugin_configs/workspaces.lua:5: attempt to index global 'util' (a nil value) stack traceback: .../swellmai/.config/nvim/lua/plugin_configs/workspaces.lua:5: in main chunk [C]: in function 'require' /Users/swellmai/.config/nvim/lua/plugin_configs/init.lua:6: in main chunk [C]: in function 'require' /Users/swellmai/.config/nvim/init.lua:8: in main chunk Press ENTER or type command to continue

It looks like nvim can't find the location of "util".

Here is my config for workspaces.nvim 截屏2022-07-06 15 52 36

natecraddock commented 2 years ago

So the issue here is that util is something I use internally in workspaces. You can totally access it if you want (require "workspaces.util"), but you likely just want to use the / character in place of util.path.sep. The full line would be:

path = vim.fn.stdpath("data") .. "/workspaces",

But you really don't need to pass in any config if you aren't modifying anything. You don't even need to run the setup() function! The only reason you need the setup is to modify the default settings. The only config that most people touch is hooks, which can be done by following the examples at the bottom of the readme. So if you want to setup hooks, or change the defaults you need the setup function.

Let me know if that works! And it's really my bad here, for leaving the util.path.sep, that would be confusing! I'll update the readme.

hatute commented 2 years ago

@natecraddock Yea! Thank you for your explanation and it works with "slash". I want to say, the function of "util.path.seq" is very useful, especially for multi-os situation.