knap icon indicating copy to clipboard operation
knap copied to clipboard

Launching Preview on OSX Sonoma

Open Crenshinibon opened this issue 8 months ago • 6 comments

With NeoVim (v0.10.0), Lazy and the latest knap version I get the following error when trying to lunch the preview:

E5108: Error executing lua: /Users/porsched/.local/share/nvim/lazy/knap/lua/knap.lua:134: attempt to call upvalue 'err_msg' (a nil value)
stack traceback:
        /Users/porsched/.local/share/nvim/lazy/knap/lua/knap.lua:134: in function 'get_os'
        /Users/porsched/.local/share/nvim/lazy/knap/lua/knap.lua:137: in main chunk
        [C]: in function 'require'
        /Users/porsched/.config/nvim/init.lua:157: in function </Users/porsched/.config/nvim/init.lua:156>

It seems as if this function is the problem:

function get_os()
    local os_current = vim.loop.os_uname().sysname
    local isWindows,j = string.find(os_current,"Windows")

    if os_current == "Linux" then
        return "linux"
    elseif isWindows ~= nil then
        return "windows"
    else
        err_msg("Unknown operating system")
    end
end

When I change it like this:

function get_os()
    local os_current = vim.loop.os_uname().sysname
    local isWindows,j = string.find(os_current,"Windows")

    if os_current == "Linux" then
        return "linux"
    elseif isWindows ~= nil then
        return "windows"
    else
        return "linux"
        --err_msg("Unknown operating system")
    end
end

I don't get the error and the preview is opening up as expected.

Crenshinibon avatar Jun 13 '24 11:06 Crenshinibon