{"id":13898954,"url":"https://github.com/xolox/vim-lua-ftplugin","last_synced_at":"2025-09-19T20:32:43.156Z","repository":{"id":137547287,"uuid":"1893742","full_name":"xolox/vim-lua-ftplugin","owner":"xolox","description":"Lua file type plug-in for the Vim text editor","archived":false,"fork":false,"pushed_at":"2020-02-03T17:58:55.000Z","size":782,"stargazers_count":189,"open_issues_count":24,"forks_count":27,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-02-21T22:29:46.442Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://peterodding.com/code/vim/lua-ftplugin","language":"VimL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xolox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-06-14T10:43:02.000Z","updated_at":"2025-02-02T14:21:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"ddd8465d-ae1f-4417-89cf-52ec441b867d","html_url":"https://github.com/xolox/vim-lua-ftplugin","commit_stats":null,"previous_names":[],"tags_count":62,"template":false,"template_full_name":null,"purl":"pkg:github/xolox/vim-lua-ftplugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolox%2Fvim-lua-ftplugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolox%2Fvim-lua-ftplugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolox%2Fvim-lua-ftplugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolox%2Fvim-lua-ftplugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xolox","download_url":"https://codeload.github.com/xolox/vim-lua-ftplugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xolox%2Fvim-lua-ftplugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275997984,"owners_count":25567384,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-19T02:00:09.700Z","response_time":108,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T18:04:33.157Z","updated_at":"2025-09-19T20:32:43.104Z","avatar_url":"https://github.com/xolox.png","language":"VimL","funding_links":[],"categories":["Vim Script"],"sub_categories":[],"readme":"# Lua file type plug-in for the Vim text editor\n\nThe [Lua][lua] file type plug-in for [Vim][vim] makes it easier to work with Lua source code in Vim by providing the following features:\n\n * The ['includeexpr'][inex] option is set so that the [gf][gf] (go to file) mapping knows how to resolve Lua module names using [package.path][pp]\n\n * The ['include'][inc] option is set so that Vim follows [dofile()][dof], [loadfile()][lof] and [require()][req] calls when looking for identifiers in included files (this works together with the ['includeexpr'][inex] option)\n\n * An automatic command is installed that runs `luac -p` when you save your Lua scripts. If `luac` reports any errors they are shown in the quick-fix list and Vim jumps to the line of the first error. If `luac -p` doesn't report any errors a check for undefined global variables is performed by parsing the output of `luac -p -l`\n\n * `K` (normal mode) and `\u003cF1\u003e` (insert mode) on a Lua function or 'method' call will try to open the relevant documentation in the [Lua Reference for Vim][lrv]\n\n * The ['completefunc'][cfu] option is set to allow completion of Lua 5.2 keywords, global variables and library members using Control-X Control-U\n\n * 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\n\n![Screenshot of omni completion](http://peterodding.com/code/vim/lua-ftplugin/screenshots/omni-completion.png)\n\n * Several [text-objects][tob] are defined so you can jump between blocks and functions\n\n * A pretty nifty hack of the [matchit plug-in][mit] is included: When the cursor is on a `function` or `return` keyword the `%` mapping cycles between the relevant keywords (`function`, `return`, `end`), this also works for branching statements (`if`, `elseif`, `else`, `end`) and looping statements (`for`, `while`, `repeat`, `until`, `end`)\n\n## Installation\n\n*Please note that the vim-lua-ftplugin plug-in requires my vim-misc plug-in which is separately distributed.*\n\nUnzip the most recent ZIP archives of the [vim-lua-ftplugin] [download-lua-ftplugin] and [vim-misc] [download-misc] plug-ins inside your Vim profile directory (usually this is `~/.vim` on UNIX and `%USERPROFILE%\\vimfiles` on Windows), restart Vim and execute the command `:helptags ~/.vim/doc` (use `:helptags ~\\vimfiles\\doc` instead on Windows).\n\nIf you prefer you can also use [Pathogen] [pathogen], [Vundle] [vundle] or a similar tool to install \u0026 update the [vim-lua-ftplugin] [github-lua-ftplugin] and [vim-misc] [github-misc] plug-ins using a local clone of the git repository.\n\nNow try it out: Edit a Lua script and try any of the features documented above.\n\nNote that on Windows a command prompt window pops up whenever Lua is run as an external process. If this bothers you then you can install my [shell.vim][shell] plug-in which includes a [DLL][dll] that works around this issue. Once you've installed both plug-ins it should work out of the box!\n\n## Options\n\nThe Lua file type plug-in handles options as follows: First it looks at buffer local variables, then it looks at global variables and if neither exists a default is chosen. This means you can change how the plug-in works for individual buffers. For example to change the location of the Lua compiler used to check the syntax:\n\n    \" This sets the default value for all buffers.\n    :let g:lua_compiler_name = '/usr/local/bin/luac'\n\n    \" This is how you change the value for one buffer.\n    :let b:lua_compiler_name = '/usr/local/bin/lualint'\n\n### The `lua_path` option\n\nThis option contains the value of `package.path` as a string. You shouldn't need to change this because the plug-in is aware of [$LUA_PATH][pp] and if that isn't set the plug-in will run a Lua interpreter to get the value of [package.path][pp].\n\n### The `lua_check_syntax` option\n\nWhen you write a Lua script to disk the plug-in automatically runs the Lua compiler to check for syntax errors. To disable this behavior you can set this option to false (0):\n\n    let g:lua_check_syntax = 0\n\nYou can manually check the syntax using the `:CheckSyntax` command.\n\n### The `lua_check_globals` option\n\nWhen you write a Lua script to disk the plug-in automatically runs the Lua compiler to check for undefined global variables. To disable this behavior you can set this option to false (0):\n\n    let g:lua_check_globals = 0\n\nYou can manually check the globals using the `:CheckGlobals` command.\n\n### The `lua_interpreter_path` option\n\nThe name or path of the Lua interpreter used to evaluate Lua scripts used by the plug-in (for example the script that checks for undefined global variables, see `:LuaCheckGlobals`).\n\n### The `lua_internal` option\n\nIf you're running a version of Vim that supports the Lua Interface for Vim (see [if_lua.txt][if_lua.txt]) then all Lua code evaluated by the Lua file type plug-in is evaluated using the Lua Interface for Vim. If the Lua Interface for Vim is not available the plug-in falls back to using an external Lua interpreter. You can set this to false (0) to force the plug-in to use an external Lua interpreter.\n\n### The `lua_compiler_name` option\n\nThe name or path of the Lua compiler used to check for syntax errors (defaults to `luac`). You can set this option to run the Lua compiler from a non-standard location or to run a dedicated syntax checker like [lualint][ll].\n\n### The `lua_compiler_args` option\n\nThe argument(s) required by the compiler or syntax checker (defaults to `-p`).\n\n### The `lua_error_format` option\n\nIf you use a dedicated syntax checker you may need to change this option to reflect the format of the messages printed by the syntax checker.\n\n### The `lua_complete_keywords` option\n\nTo disable completion of keywords you can set this option to false (0).\n\n### The `lua_complete_globals` option\n\nTo disable completion of global functions you can set this option to false (0).\n\n### The `lua_complete_library` option\n\nTo disable completion of library functions you can set this option to false (0).\n\n### The `lua_complete_dynamic` option\n\nWhen you type a dot after a word the Lua file type plug-in will automatically start completion. To disable this behavior you can set this option to false (0).\n\n### The `lua_complete_omni` option\n\nThis option is disabled by default for two reasons:\n\n * The omni completion support works by enumerating and loading all installed modules. **If module loading has side effects this can have unintended consequences!**\n * Because all modules installed on the system are loaded, collecting the completion candidates can be slow. After the first run the completion candidates are cached so this will only bother you once (until you restart Vim).\n\nIf you want to use the omni completion despite the warnings above, execute the following command:\n\n    :let g:lua_complete_omni = 1\n\nNow when you type Control-X Control-O Vim will hang for a moment, after which you should be presented with an enormous list of completion candidates :-)\n\n### The `lua_omni_blacklist` option\n\nIf you like the omni completion mode but certain modules are giving you trouble (for example crashing Vim) you can exclude such modules from being loaded by the omni completion. You can do so by setting `lua_omni_blacklist` to a list of strings containing Vim regular expression patterns. The patterns are combined as follows:\n\n    \" Here's the black list:\n    let g:lua_omni_blacklist = ['pl\\.strict', 'lgi\\..']\n\n    \" Here's the resulting regular expression pattern:\n    '^\\(pl\\.strict\\|lgi\\..\\)$'\n\nThe example above prevents the module `pl.strict` and all modules with the prefix `lgi.` from being loaded.\n\n### The `lua_safe_omni_modules` option\n\nTo track down modules that cause side effects while loading, setting\n\n    :let g:lua_safe_omni_modules = 1\n\nrestricts the modules to be loaded to the standard Lua modules - which should be safe to load - and provides a list of modules that would have been loaded if this option was not set via the `:messages` command. With this list, the `lua_omni_blacklist` can be iteratively refined to exclude offending modules from omni completion module loading.\n\nNote that the ['verbose'] [] option has to be set to 1 or higher for the list to be recorded.\n\n### The `lua_define_completefunc` option\n\nBy default the Lua file type plug-in sets the ['completefunc'] [] option so that Vim can complete Lua keywords, global variables and library members using Control-X Control-U. If you don't want the 'completefunc' option to be changed by the plug-in, you can set this option to zero (false) in your [vimrc script] [vimrc]:\n\n    :let g:lua_define_completefunc = 0\n\n### The `lua_define_omnifunc` option\n\nBy default the Lua file type plug-in sets the ['omnifunc'] [] option so that Vim can complete the names of all Lua modules installed on the local system. If you don't want the 'omnifunc' option to be changed by the plug-in, you can set this option to zero (false) in your [vimrc script] [vimrc]:\n\n    :let g:lua_define_omnifunc = 0\n\n### The `lua_define_completion_mappings` option\n\nBy default the Lua file type plug-in defines insert mode mappings so that the plug-in is called whenever you type a single quote, double quote or a dot inside a Lua buffer. This enables context sensitive completion. If you don't like these mappings you can set this option to zero (false). In that case the mappings will not be defined.\n\n## Commands\n\n### The `:LuaCheckSyntax` command\n\nCheck the current file for syntax errors using the Lua compiler. This command is executed automatically when you write a Lua script to disk (i.e. when you save your changes) unless `lua_check_syntax` is false.\n\n### The `:LuaCheckGlobals` command\n\nCheck the current file for undefined global variables. This command is executed automatically when you write a Lua script to disk (i.e. when you save your changes) unless `lua_check_globals` is false or syntax errors were detected.\n\n## Contact\n\nIf you have questions, bug reports, suggestions, etc. the author can be contacted at \u003cpeter@peterodding.com\u003e. The latest version is available at \u003chttp://peterodding.com/code/vim/lua-ftplugin\u003e and \u003chttp://github.com/xolox/vim-lua-ftplugin\u003e. If you like this plug-in please vote for it on [Vim Online][script].\n\n## License\n\nThis software is licensed under the [MIT license](http://en.wikipedia.org/wiki/MIT_License).  \n© 2014 Peter Odding \u0026lt;\u003cpeter@peterodding.com\u003e\u0026gt;.\n\nThanks go out to everyone who has helped to improve the Lua file type plug-in for Vim (whether through pull requests, bug reports or personal e-mails).\n\n\n['verbose']: http://vimdoc.sourceforge.net/htmldoc/options.html#'verbose'\n['completefunc']: http://vimdoc.sourceforge.net/htmldoc/options.html#'completefunc'\n['omnifunc']: http://vimdoc.sourceforge.net/htmldoc/options.html#'omnifunc'\n[cfu]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27completefunc%27\n[dll]: http://en.wikipedia.org/wiki/Dynamic-link_library\n[dof]: http://www.lua.org/manual/5.2/manual.html#pdf-dofile\n[download-lua-ftplugin]: http://peterodding.com/code/vim/downloads/lua-ftplugin.zip\n[download-misc]: http://peterodding.com/code/vim/downloads/misc.zip\n[gf]: http://vimdoc.sourceforge.net/htmldoc/editing.html#gf\n[github-lua-ftplugin]: http://github.com/xolox/vim-lua-ftplugin\n[github-misc]: http://github.com/xolox/vim-misc\n[if_lua.txt]: http://vimdoc.sourceforge.net/htmldoc/if_lua.html#if_lua.txt\n[inc]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27include%27\n[inex]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27includeexpr%27\n[ll]: http://lua-users.org/wiki/LuaLint\n[lof]: http://www.lua.org/manual/5.2/manual.html#pdf-loadfile\n[lrv]: http://www.vim.org/scripts/script.php?script_id=1291\n[lua]: http://www.lua.org/\n[mit]: http://vimdoc.sourceforge.net/htmldoc/usr_05.html#matchit-install\n[ofu]: http://vimdoc.sourceforge.net/htmldoc/options.html#%27omnifunc%27\n[pathogen]: http://www.vim.org/scripts/script.php?script_id=2332\n[pp]: http://www.lua.org/manual/5.2/manual.html#pdf-package.path\n[req]: http://www.lua.org/manual/5.2/manual.html#pdf-require\n[script]: http://www.vim.org/scripts/script.php?script_id=3625\n[shell]: http://peterodding.com/code/vim/shell/\n[tob]: http://vimdoc.sourceforge.net/htmldoc/motion.html#text-objects\n[vim]: http://www.vim.org/\n[vimrc]: http://vimdoc.sourceforge.net/htmldoc/starting.html#vimrc\n[vundle]: https://github.com/gmarik/vundle\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxolox%2Fvim-lua-ftplugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxolox%2Fvim-lua-ftplugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxolox%2Fvim-lua-ftplugin/lists"}