Lua mode
lua-mode is a major mode for editing Lua sources in Emacs.
If you have a problem or a suggestion about lua-mode, please, let me know about it via github’s Issue Tracker.
FEATURES
- syntactic indentation & highlighting (including multiline literals/comments)
- evaluation of lines/regions/functions/files in Lua subprocess or direct interaction with its REPL
- documentation lookup (using online/offline reference manual, e.g. string.find)
- imenu integration
- HideShow integration
- Flymake integration for on-the-fly linting. The luacheck program is required for this. It can be installed e.g. via luarocks.
CUSTOMIZATION
The following variables are available for customization (see more via M-x customize-group lua
):
- Var
lua-indent-level
(default3
): indentation offset in spaces - Var
lua-indent-string-contents
(defaultnil
): set tot
if you like to have contents of multiline strings to be indented like comments - Var
lua-indent-nested-block-content-align
(defaultt
) set tonil
to stop aligning the content of nested blocks with the open parenthesis - Var
lua-indent-close-paren-align
(defaultt
) set tot
to align close parenthesis with the open parenthesis rather than with the beginning of the line - Var
lua-mode-hook
: list of functions to execute when lua-mode is initialized - Var
lua-documentation-url
(default"http://www.lua.org/manual/5.1/manual.html#pdf-"
): base URL for documentation lookup - Var
lua-documentation-function
(defaultbrowse-url
): function used to show documentation (eww
is a viable alternative for Emacs 25)
LUA SUBPROCESS CREATION
- Var
lua-default-application
(default"lua"
): command to start up the subprocess (REPL) - Var
lua-default-command-switches
(default"-i"
): arguments to pass to the subprocess on startup (make sure-i
is there if you expect working with Lua shell interactively) - Cmd
lua-start-process
: start new REPL process, usually happens automatically - Cmd
lua-kill-process
: kill current REPL process
LUA SUBPROCESS INTERACTION
- Cmd
lua-show-process-buffer
: switch to REPL buffer - Cmd
lua-hide-process-buffer
: hide window showing REPL buffer - Var
lua-always-show
: show REPL buffer after sending something - Cmd
lua-send-buffer
: send whole buffer - Cmd
lua-send-current-line
: send current line - Cmd
lua-send-defun
: send current top-level function - Cmd
lua-send-region
: send active region - Cmd
lua-restart-with-whole-file
: restart REPL and send whole buffer