lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On Mar 10, 2018, at 1:49 PM, Hugo Musso Gualandi <hgualandi@inf.puc-rio.br> wrote:

My questions to this list are as follows:

- Is anyone else bothered by the Vim's Lua indentation like I am?
- Do any of you use custom Vim indentation scripts? (Which one?)
- What we can do to improve Lua indentation in upstream Vim?


It's occasionally annoying, but most of the irregularities are only mildly inconvenient. The one that really frustrates me though, is that the indentation is completely unaware of long bracket strings. For example, this code prints "This sentence is the\nend of the paragraph.":

if true then
    pcall(function()
        print[[
This sentence is the
end of the paragraph.]]
    end)
end

But it gets auto-indented into code with not only bad indentation, but also completely different behavior (the code now prints "        This sentence is the\n    end of the paragraph."):

if true then
    pcall(function()
        print[[
        This sentence is the
    end of the paragraph.]]
end)
end

Since I've been doing a bunch of work with dynamically generated Lua code, this particular issue is actually something that has bothered me a lot. It's really more of a Vim problem than a Lua problem though. If you want Vim's default Lua indentation to improve, you'd need to get a patch to this file approved:
https://github.com/vim/vim/blob/master/runtime/indent/lua.vim

Attachment: signature.asc
Description: Message signed with OpenPGP