diff --git a/README.md b/README.md index e0806e2..53bd9d3 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,62 @@ -# Lua language support in Atom +Lua language support in Atom +====== Add syntax highlighting and snippets to Lua files in Atom. -Originally [converted](http://atom.io/docs/latest/converting-a-text-mate-bundle) -from the [Lua TextMate bundle](https://github.com/textmate/lua.tmbundle). +Common snippets +--- +| Trigger | Name | Body | +| ------------- |--------------------------| ---------------------| +| -[ | multiline comment | --[[ comment... ]] | +| =[ | nested multiline comment | --[=[ comment... ]=] | +| afun | anon function | functionName = function (args) -- body... end | +| for | for i=1,10 | for i = 1, 10 do -- body... end | +| fori | for i,v in ipairs() | for i,v in ipairs(table_name) do -- body... end | +| forp | for k,v in pairs() | for k,v in pairs(table_name) do -- body... end | +| fun | function | function functionName (args) -- body... end | +| if | if conditional | if value then --body... end | +| ife | if else conditional | if value then --body... else --body... end | +| ifn | if not conditional | if not value then --body... end | +| ifne | if not else conditional | if not value then --body... else --body... end | +| loc | local variable definition shortcut | local x = 1 | +| local | local variable definition | local x = 1 | +| log | log | print("logging") | +| ltab | local table definition | local name = {} | +| rep | repeat loop shortcut | repeat -- body... until condition | +| repeat | repeat loop | repeat -- body... until condition | +| req | require shortcut | local name = require "module" | +| require | require | local name = require "module" | +| ret | return definition shortcut | return value | +| return | return definition | return value | +| tab | table definition | name = {} | +| whi | while loop shortcut | while condition do -- body... end | +| while | while loop shortcut | while condition do -- body... end | + +Table function snippets +--- +| Trigger | Name | Body | +| ------------- |--------------------------| ---------------------| +| tabc | table.concat | table.concat(tableName, " ", start_index, end_index) | +| tabf | table.foreach | table.foreach(tableName, function) | +| tabi | table.insert | table.insert(tableName, data) | +| tabs | table.sort | table.sort(tableName, sortfunction) | + + +Author +------ +__Jorge Garrido Oval__ +* [https://github.com/FireZenk](https://github.com/FireZenk) + + +Contributors +--- Contributions are greatly appreciated. Please fork this repository and open a pull request to add snippets, make grammar tweaks, etc. + +License +------ +Bigot is released under the MIT license. + +>Originally [converted](http://atom.io/docs/latest/converting-a-text-mate-bundle) +from the [Lua TextMate bundle](https://github.com/textmate/lua.tmbundle). diff --git a/snippets/language-lua.cson b/snippets/language-lua.cson index c9e0929..2a9cce0 100644 --- a/snippets/language-lua.cson +++ b/snippets/language-lua.cson @@ -72,26 +72,14 @@ 'prefix': 'tab' 'body': '${0:name} = {}' 'table.insert': - 'prefix': 'table.insert', - 'body': 'table.insert(${0:dest},${1:data})' - 'table.insert shorcut': 'prefix': 'tabi', - 'body': 'table.insert(${0:dest},${1:data})' + 'body': 'table.insert(${0:tableName},${1:data})' 'table.foreach': - 'prefix': 'table.foreach', - 'body': 'table.foreach(${0:table},${1:function})' - 'table.foreach shortcut': 'prefix': 'tabf', - 'body': 'table.foreach(${0:table},${1:function})' + 'body': 'table.foreach(${0:tableName},${1:function})' 'table.concat': - 'prefix': 'table.concat' - 'body': 'table.concat(${1:tablename}${2:, ", "}${3:, start_index}${4:, end_index})' - 'table.concat shortcut': 'prefix': 'tabc' - 'body': 'table.concat(${1:tablename}${2:, ", "}${3:, start_index}${4:, end_index})' + 'body': 'table.concat(${1:tableName}${2:, " "}${3:, start_index}${4:, end_index})' 'table.sort': - 'prefix': 'table.sort' - 'body': 'table.sort(${1:tablename}${2:, sortfunction})' - 'table.sort shortcut': 'prefix': 'tabs', - 'body': 'table.sort(${1:tablename}${2:, sortfunction})' + 'body': 'table.sort(${1:tableName}${2:, sortfunction})'