-
-
Notifications
You must be signed in to change notification settings - Fork 853
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
using local plugin without git #6596
Comments
Can you please elaborate on this? I was able to use local directories and have it parse directory locations without any issues. |
Whereas a local checkout of a plugin should get loaded successfully, such a directory without the error snippet
|
Hi @KiaraGrouwstra, just like you i wanted to manage my plugins using nix, especially controlling the exact git revision. First i tried to clone the repos from the store using So what i opted for instead is not using the Heres the examples from my nix config, but people without nix can use the same techniques to load plugins from any path. {pkgs, ...}: let
wezterm_tabline = pkgs.fetchFromGitHub {
owner = "michaelbrusegard";
repo = "tabline.wez";
rev = "c4c9573bc292a8483a0eab398ef51768d008263b";
sha256 = "sha256-40fZaveu8JnbVZtDHiRAEVRTonrSyhrJRl7SrpIaoBw=";
};
wezterm_switcher = pkgs.fetchFromGitHub {
owner = "MLFlexer";
repo = "smart_workspace_switcher.wezterm";
rev = "ef7b5de9280cb8270767cca87385e0a16ed8ead7";
hash = "sha256-ClhlFTiT0e3gNGid0XomiSMLUJ6FAvE26okoeLNL1C0=";
};
wezterm_resurrect = pkgs.fetchFromGitHub {
owner = "MLFlexer";
repo = "resurrect.wezterm";
rev = "8abcbd3345cd95a679d9bd79e4f613f3530c633b";
hash = "sha256-v8yhkqrjbZAixGDvweKo/uGSkTA+mmGV2isRixmHUfU=";
};
in {
xdg.configFile."wezterm/plugins.lua".text = ''
local M = {}
local function loadPlugin(plugin_path)
package.path = package.path .. ';' .. plugin_path .. '/plugin/?.lua'
return dofile(plugin_path .. '/plugin/init.lua')
end
function M.tabline()
return loadPlugin('${wezterm_tabline}')
end
function M.switcher()
return loadPlugin('${wezterm_switcher}')
end
function M.resurrect()
return loadPlugin('${wezterm_resurrect}')
end
return M
'';
} and in my main wezterm config (which i don't manage through nix and a symlink instead, to avoid building for every change): local function file_exists(name)
local f = io.open(name, "r")
return f ~= nil and io.close(f)
end
if file_exists(os.getenv("HOME") .. "/.config/wezterm/plugins.lua") then
local plugins = require("plugins")
plugins.tabline().setup({options = {theme = 'Rosé Pine (base16)'}})
end Hope this works for your usecase as well! :) UPDATE: This can be easily fixed in the individual plugins, eventually i will get to this sometime. |
Is your feature request related to a problem? Please describe.
wezterm.plugin.require
may be used to load plugins from a local directory, but unfortunately seems tied to Git.this now makes it harder to use alternate methods to distribute plugins, for example to reproduce plugin setups (say using Nix), which may be desirable for security.
Describe the solution you'd like
allow
wezterm.plugin.require
(or similar) to be used without Git, given that seems used only for downloading remote plugins (rather than adding value for local plugins as well)Describe alternatives you've considered
Additional context
c.f.
The text was updated successfully, but these errors were encountered: