Lua vim indentation

16 views
Skip to first unread message

Ni Va

unread,
May 18, 2022, 3:00:28 AM5/18/22
to vim_use
Hi, 

DON'T HAPPENING to get correct vim lua indentation, is someone can help me ? 

function trace(t) -- {{{

    setmetatable(t,{__index={s="", f=true}})
    local s, f =
    t[1] or t.s,
    t[2] or t.f -- force

    if dbgmode then
        if f then
            print ( os.date('%Y-%m-%d %H-%M-%S: ') .. s )
        end
    end
end -- }}}

-

Thank you. 

Ni Va

unread,
May 19, 2022, 4:45:35 AM5/19/22
to vim_use
OK issue indenting due to comment after and on same mine of function déclarés. 

The second syntax formed enable good indenting. 


function matchPattern(line, pattern) -- {{{

local x=line:match(pattern)
if x~=nil then
    return ownsplit(x, '=')
end
end -- }}}

function matchPattern(line, pattern)

    local x=line:match(pattern)
    if x~=nil then
        return ownsplit(x, '=')
    end
end
Reply all
Reply to author
Forward
0 new messages