Skip to content

Error when toggling Atraxis mode #141

Open
@serialized-kirin

Description

@serialized-kirin

I'm getting an error when toggling Atraxis mode using :lua require("true-zen.ataraxis").toggle():

E5108: Error executing lua .../pack/deps/opt/true-zen.nvim/lua/true-zen/minimalist.lua:118: Invalid value for 
option 'showmode': expected boolean, got number 0                                                             
stack traceback:                                                                                              
        [C]: in function '__newindex'                                                                         
        .../pack/deps/opt/true-zen.nvim/lua/true-zen/minimalist.lua:118: in function 'off'                    
        ...te/pack/deps/opt/true-zen.nvim/lua/true-zen/ataraxis.lua:252: in function 'off'                    
        ...te/pack/deps/opt/true-zen.nvim/lua/true-zen/ataraxis.lua:291: in function 'toggle'                 
        [string ":lua"]:1: in main chunk                                                                      
Press ENTER or type command to continue

It does successfully toggle off, but it does not change the running state, so trying to toggle it back on doesn't work after toggling it off.

After a little of digging, i think it's because gettabwinvar is used to get the option values (minimalist.lua:58), but the options are set using vim.o, so i think that's probably it? Also for some context I set noshowmode in my init.lua.
I've fixed the problem for me, but like it feels hacky and I only know the problems I ended up encountering ofc but ye I just was left with this instead of the line on minimalist.lua:188:

            -- o[k] = v
            if type(v) == 'boolean' and type(o[k]) == 'number' then -- error about showmode
                o[k] = v and 1 or 0
            elseif type(v) == 'boolean' and type(o[k]) == 'string' then -- error about signcolumn
                o[k] = v and 'on' or 'off' -- v and 'yes' or 'no'
            end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions