Skip to content

Commit

Permalink
Update to Lua 5.2 keywords and standard libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Storm authored and Christian Storm committed Sep 13, 2014
1 parent 5527820 commit 50c7fc1
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 72 deletions.
10 changes: 5 additions & 5 deletions README.md
Expand Up @@ -10,7 +10,7 @@ The [Lua][lua] file type plug-in for [Vim][vim] makes it easier to work with Lua

* `K` (normal mode) and `<F1>` (insert mode) on a Lua function or 'method' call will try to open the relevant documentation in the [Lua Reference for Vim][lrv]

* The ['completefunc'][cfu] option is set to allow completion of Lua 5.1 keywords, global variables and library members using Control-X Control-U
* The ['completefunc'][cfu] option is set to allow completion of Lua 5.2 keywords, global variables and library members using Control-X Control-U

* The ['omnifunc'][ofu] option is set to allow dynamic completion of the variables defined in all modules installed on the system using Control-X Control-O, however it needs to be explicitly enabled by setting the `lua_complete_omni` option because this functionality may have undesired side effects! When you invoke omni completion after typing `require '` or `require('` you get completion of module names

Expand Down Expand Up @@ -163,7 +163,7 @@ This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/M
['omnifunc']: http://vimdoc.sourceforge.net/htmldoc/options.html#'omnifunc'
[cfu]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27completefunc%27
[dll]: http://en.wikipedia.org/wiki/Dynamic-link_library
[dof]: http://www.lua.org/manual/5.1/manual.html#pdf-dofile
[dof]: http://www.lua.org/manual/5.2/manual.html#pdf-dofile
[download-lua-ftplugin]: http://peterodding.com/code/vim/downloads/lua-ftplugin.zip
[download-misc]: http://peterodding.com/code/vim/downloads/misc.zip
[gf]: http://vimdoc.sourceforge.net/htmldoc/editing.html#gf
Expand All @@ -173,14 +173,14 @@ This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/M
[inc]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27include%27
[inex]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27includeexpr%27
[ll]: http://lua-users.org/wiki/LuaLint
[lof]: http://www.lua.org/manual/5.1/manual.html#pdf-loadfile
[lof]: http://www.lua.org/manual/5.2/manual.html#pdf-loadfile
[lrv]: http://www.vim.org/scripts/script.php?script_id=1291
[lua]: http://www.lua.org/
[mit]: http://vimdoc.sourceforge.net/htmldoc/usr_05.html#matchit-install
[ofu]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27omnifunc%27
[pathogen]: http://www.vim.org/scripts/script.php?script_id=2332
[pp]: http://www.lua.org/manual/5.1/manual.html#pdf-package.path
[req]: http://www.lua.org/manual/5.1/manual.html#pdf-require
[pp]: http://www.lua.org/manual/5.2/manual.html#pdf-package.path
[req]: http://www.lua.org/manual/5.2/manual.html#pdf-require
[script]: http://www.vim.org/scripts/script.php?script_id=3625
[shell]: http://peterodding.com/code/vim/shell/
[tob]: http://vimdoc.sourceforge.net/htmldoc/motion.html#text-objects
Expand Down
2 changes: 1 addition & 1 deletion autoload/xolox/lua.vim
Expand Up @@ -390,7 +390,7 @@ function! xolox#lua#getomnimodules() " {{{1
endfor
let modules = keys(modulemap)
" Always include the standard library modules.
call extend(modules, ['coroutine', 'debug', 'io', 'math', 'os', 'package', 'string', 'table'])
call extend(modules, ['bit32', 'coroutine', 'debug', 'io', 'math', 'os', 'package', 'string', 'table'])
call sort(modules, 1)
let blacklist = xolox#misc#option#get('lua_omni_blacklist', [])
let pattern = printf('^\(%s\)$', join(blacklist, '\|'))
Expand Down
133 changes: 76 additions & 57 deletions autoload/xolox/lua_data.vim

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions doc/ft_lua.txt
Expand Up @@ -54,7 +54,7 @@ code in Vim by providing the following features:
call will try to open the relevant documentation in the Lua Reference for
Vim [6]

- The |'completefunc'| option is set to allow completion of Lua 5.1 keywords,
- The |'completefunc'| option is set to allow completion of Lua 5.2 keywords,
global variables and library members using Control-X Control-U

- The |'omnifunc'| option is set to allow dynamic completion of the variables
Expand Down Expand Up @@ -309,10 +309,10 @@ This software is licensed under the MIT license [18]. Š 2014 Peter Odding
References ~

[1] http://www.lua.org/
[2] http://www.lua.org/manual/5.1/manual.html#pdf-package.path
[3] http://www.lua.org/manual/5.1/manual.html#pdf-dofile
[4] http://www.lua.org/manual/5.1/manual.html#pdf-loadfile
[5] http://www.lua.org/manual/5.1/manual.html#pdf-require
[2] http://www.lua.org/manual/5.2/manual.html#pdf-package.path
[3] http://www.lua.org/manual/5.2/manual.html#pdf-dofile
[4] http://www.lua.org/manual/5.2/manual.html#pdf-loadfile
[5] http://www.lua.org/manual/5.2/manual.html#pdf-require
[6] http://www.vim.org/scripts/script.php?script_id=1291
[7] http://peterodding.com/code/vim/lua-ftplugin/screenshots/omni-completion.png
[8] http://peterodding.com/code/vim/downloads/lua-ftplugin.zip
Expand Down
2 changes: 1 addition & 1 deletion ftplugin/lua.vim
@@ -1,5 +1,5 @@
" Vim file type plug-in
" Language: Lua 5.1
" Language: Lua 5.2
" Author: Peter Odding <peter@peterodding.com>
" Last Change: June 17, 2014
" URL: http://peterodding.com/code/vim/lua-ftplugin
Expand Down
2 changes: 1 addition & 1 deletion misc/lua-ftplugin/getsignatures.lua
@@ -1,7 +1,7 @@
#!/usr/bin/env lua

local http = require 'socket.http'
local webpage = http.request 'http://www.lua.org/manual/5.1/manual.html'
local webpage = http.request 'http://www.lua.org/manual/5.2/manual.html'
local matches = {}
for anchor, signature in webpage:gmatch '<h3>%s*<a%s+name="pdf%-(.-)">%s*<code>%s*(.-)%s*</code>%s*</a>%s*</h3>' do
if anchor ~= signature then
Expand Down
2 changes: 1 addition & 1 deletion misc/lua-ftplugin/omnicomplete.lua
Expand Up @@ -16,7 +16,7 @@ global state.

local keywords = { ['and'] = true, ['break'] = true, ['do'] = true,
['else'] = true, ['elseif'] = true, ['end'] = true, ['false'] = true,
['for'] = true, ['function'] = true, ['if'] = true, ['in'] = true,
['for'] = true, ['function'] = true, ['goto'] = true, ['if'] = true, ['in'] = true,
['local'] = true, ['nil'] = true, ['not'] = true, ['or'] = true,
['repeat'] = true, ['return'] = true, ['then'] = true, ['true'] = true,
['until'] = true, ['while'] = true }
Expand Down
2 changes: 1 addition & 1 deletion plugin/lua-ftplugin.vim
@@ -1,5 +1,5 @@
" Vim file type plug-in
" Language: Lua 5.1
" Language: Lua 5.2
" Author: Peter Odding <peter@peterodding.com>
" Last Change: August 19, 2013
" URL: http://peterodding.com/code/vim/lua-ftplugin
Expand Down

0 comments on commit 50c7fc1

Please sign in to comment.