michaelbrusegard / tabline.wez

A versatile and easy to use retro tab bar plugin for the WezTerm terminal emulator created with the lualine.nvim configuration format
MIT License
42 stars 5 forks source link

tabline.config not found #35

Open sho-87 opened 1 week ago

sho-87 commented 1 week ago

Ive added the following lines to my wezterm config:

local tabline = wezterm.plugin.require("http://github.com/michaelbrusegard/tabline.wez")
tabline.setup()

but am getting an error when starting wezterm:

runtime error: ...DscomsZsmichaelbrusegardsZstablinesDswez/plugin/init.lua:35:
module 'tabline.config' not found:
        no field package.preload['tabline.config']
        no file 'C:\Program Files\WezTerm\wezterm_modules/tabline\config.lua'
        no file 'C:\Program Files\WezTerm\wezterm_modules/tabline\config/init.lua'
        no file 'C:\Users\simon\.config\wezterm/tabline\config.lua'
        no file 'C:\Users\simon\.config\wezterm/tabline\config/init.lua'
        no file 'C:\Users\simon\AppData\Roaming\wezterm/plugins/tabline\config/plugin/
init.lua'
        no file 'C:\Users\simon\.wezterm/tabline\config.lua'
        no file 'C:\Users\simon\.wezterm/tabline\config/init.lua'
        no file 'C:\Program Files\WezTerm\lua\tabline\config.lua'
        no file 'C:\Program Files\WezTerm\lua\tabline\config\init.lua'
        no file 'C:\Program Files\WezTerm\tabline\config.lua'
        no file 'C:\Program Files\WezTerm\tabline\config\init.lua'
        no file 'C:\Program Files\WezTerm\..\share\lua\5.4\tabline\config.lua'
        no file 'C:\Program Files\WezTerm\..\share\lua\5.4\tabline\config\init.lua'
        no file '.\tabline\config.lua'
        no file '.\tabline\config\init.lua'
        no file 'C:
\Users\simon\AppData\Roaming\wezterm\plugins\httpssCssZssZsgithubsDscomsZsmich
aelbrusegardsZstablinesDswez\plugin\tabline\config.lua'

        can't load C modules in safe mode
stack traceback:
        [C]: in function 'require'
        ...DscomsZsmichaelbrusegardsZstablinesDswez/plugin/init.lua:35: in function
'httpsCssZssZsgithubsDscomsZsmichaelbrusegardsZstablinesDswez.setup'
        [string "C:\Users\simon\.config\wezterm\wezterm.lua"]:4: in main chunk

one thing I had to do to even get this far was drop the s from https in the url, otherwise I get

unsupported URL protocol; class=Net (12)
stack traceback:
        [C]: in field 'require'
        [string "C:\Users\simon\.config\wezterm\wezterm.lua"]:3: in main chunk

this is on windows 11, wezterm nightly (wezterm 20240928-215536-a2f2c07a), and my wezterm config looks like this: https://github.com/sho-87/dotfiles/blob/master/config/wezterm/wezterm.lua

michaelbrusegard commented 5 days ago

I am unable to reproduce this issue. Dropping the "s" from the url will try to reach GitHub without using a TSL certificate. This seems like an issue specifically for Windows, which I am unable to test since I do not have.

The modules in this plugin are added to the path behind the "tabline" directory prefix. It is added to path based on the plugin folder name which includes "https" and not "http" which is why I think this error occurs. If you get it working with the https URL it should work. I am very confused to why you have to use it over HTTP, what is the error when doing that?

sho-87 commented 5 days ago

ahh ok so Ive figured out the main reason: in my .gitconfig Im redirecting github https calls to use ssh instead, which isnt supported by wezterm:

[url "git@github.com:"]
    insteadOf = https://github.com/

when I remove that from gitconfig then this plugin installs fine

this does bring up a related question. I use another wezterm plugin, which I can install fine using regular http. are they doing something different in terms of how the protocol is resolved that this plugin doesnt do? is that something that can be rolled in here?

the plugin is: http://github.com/MLFlexer/smart_workspace_switcher.wezterm

michaelbrusegard commented 5 days ago

Yes, the issue is that this plugin in comparison to the workspace switcher, uses multiple module instead of having everything in a single init.lua file. To achieve this I have to append the plugin directory to the path using the directory name for the plugin which is the same as the url see the code below:

local function get_require_path()
  local path1 = 'httpssCssZssZsgithubsDscomsZsmichaelbrusegardsZstablinesDswez'
  local path2 = 'httpssCssZssZsgithubsDscomsZsmichaelbrusegardsZstablinesDswezsZs'
  return directory_exists(path2) and path2 or path1
end

It expects the folder name to be https, but it will be something else when using http. I think I can add the http versions of the directory names to this for it to also work over http