lua-users home
lua-l archive

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


Hi!
I've adapted syntax/lua.vim and indent/lua.vim that come
with Vim to work with Lua 4.0 (:let lua_4=1) and Lua 5.0.
In my tests, they work fairly well, but I'd like other
users to test them.
Changes:
syntax/lua.vim
Nested [[ ]]
"for" loop (the old syntax file was for Lua 3, I believe)
Keyword "break"
Constants "true" and "false"
Nested comments --[[ ]]
Vim makes Lua long comments this way:
--[[
--xxx
--xxx]]
I would edit the ftplugin/lua.vim to avoid this, but
maybe other users like it (the ones that comment in C as:
/*
 * xxx
 */
)
Commented out preprocessor
Lua 3 library functions were replaced by Lua 4 functions.
As for Lua 5, I'm not sure if it's better to highlight
all library (string, math, table, io, os, debug)
functions, like the old syntax file, or only the basic
ones (type, assert, etc.), like most languages do.
File-handle methods won't get highlighted, so, to be
consistent, the library shouldn't either. Tell me what
you think.

indent/lua.vim
Added indentkeys to allow unindent when the user types
"end" or "until" ("else" and "elseif" already worked)
Simplified pattern matching to find out when indent or
unindent (I guess the old ones were based on Ruby and had
lots of unnecessary tests)


If you like the changes, I will send it to vim.org. Maybe
the next version of Vim comes with full Lua support!


__________________________________________________________________________
E-mail Premium BOL
Antivírus, anti-spam e até 100 MB de espaço. Assine já!
http://email.bol.com.br/

Attachment: syntax_lua.vim
Description: Binary data

Attachment: indent_lua.vim
Description: Binary data