-
-
Notifications
You must be signed in to change notification settings - Fork 797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin package path #4248
base: main
Are you sure you want to change the base?
Plugin package path #4248
Conversation
I'm a bit confused by this: My expectation is that that will try to pull in My expectation is based on thinking that all of the lua code in the plugin repo would belong under its It seems to me that my choice of What if we redefined (or rather, extended, in order to be backwards compatible with the couple of existing plugins) the plugin layout to be
From my reading of https://www.lua.org/manual/5.3/manual.html#pdf-package.searchpath I think it is valid to list Another other option for this stuff is not to use local wezterm = require("wezterm")
local module = {}
local path = ...
-- Equivalent to POSIX dirname(3)
-- Given "/foo/bar" returns "/foo/"
-- Given "c:\\foo\\bar" returns "c:\\foo\\"
function dirname(s)
return string.gsub(s, '(.*[/\\])(.*)', '%1')
end
local other_module = dofile(dirname(path) .. "other_module.lua")
return module I think it's reasonable to add |
Hi!
I think you're right.
I've tried to look it up, but I don't think it is possible to "break-up" a module-name. If I understand you correctly, you'd want it to go from If
Yes, this is also an alternative probably in case we don't find a solution with |
Related to #4150
Allows for wezterm plugins to require separate scripts besides
plugin/init.lua
in the plugin's directory.An example plugin is available: oscarcederberg/plugin-package-path.wezterm.
With this change, including the plugin will run the following scripts:
<PLUGIN_DIR>/plugin/init.lua -> <PLUGIN_DIR>/other_module/init.lua -> <PLUGIN_DIR>/other_module/other_script.lua
.Adds
<DATA_DIR>/?/.init.lua
and<DATA_DIR>/?.lua
as searchable package paths. The package path is now in this order on a laptop running Linux (logged by callingwezterm.log_info(package.path)
, formatted for readability):I didn't find myself anywhere appropriate to document this change in the code. I also tried running all tests, but my laptop doesn't seem to be able to handle them and freezes unfortunately.
Kind regards! 😃