This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+lang/lua/README.org

78 lines
2.8 KiB
Org Mode
Raw Normal View History

#+TITLE: Lua layer
2015-06-10 16:44:30 +00:00
#+TAGS: general|layer|multi-paradigm|programming
2019-05-05 17:26:40 +00:00
2015-06-10 16:44:30 +00:00
[[file:img/lua.gif]]
2019-05-07 20:05:06 +00:00
* Table of Contents :TOC_5_gh:noexport:
2017-05-22 14:16:12 +00:00
- [[#description][Description]]
- [[#features][Features:]]
- [[#install][Install]]
2019-11-12 03:29:50 +00:00
- [[#layer][Layer]]
- [[#backends][Backends]]
- [[#lsp][LSP]]
- [[#lua-mode][Lua mode]]
- [[#key-bindings][Key bindings]]
2019-11-12 03:29:50 +00:00
- [[#lsp-1][LSP]]
2017-05-22 14:16:12 +00:00
- [[#commands][Commands]]
2015-06-10 16:44:30 +00:00
* Description
This layer adds support for editing Lua.
** Features:
2015-06-10 16:44:30 +00:00
- Editing lua files using [[https://github.com/immerrr/lua-mode][lua-mode]]
- Code-Completion with =lsp= or =company-lua=
2015-06-10 16:44:30 +00:00
- Sending code to a lua REPL
- Code linting using [[https://github.com/mpeterv/luacheck][Luacheck]]
- Cross references (definitions, references, rename...)
2015-06-10 16:44:30 +00:00
* Install
2019-11-12 03:29:50 +00:00
** Layer
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
add =lua= to the existing =dotspacemacs-configuration-layers= list in this
file.
2015-06-10 16:44:30 +00:00
In order to enable code linting, install [[https://github.com/mpeterv/luacheck][Luacheck]].
2015-06-10 16:44:30 +00:00
2019-11-12 03:29:50 +00:00
** Backends
Supported backends are:
- =lsp-emmy= using clangd LSP server
- =lua-mode= using emacs package
2019-11-12 03:29:50 +00:00
*** LSP
LSP support is provided via the [[file:../../+tools/lsp/README.org][LSP layer]], currently only [[https://github.com/EmmyLua/EmmyLua-LanguageServer][EmmyLua]] is supported.
2019-11-12 03:29:50 +00:00
To use the =lsp-emmy= backend, please download the [[https://github.com/EmmyLua/EmmyLua-LanguageServer][EmmyLua-LS-all.jar]] and put it into =~/.emacs.d/=,
then set the layer variable lua-backend to =lsp-emmy=.
2019-11-12 03:29:50 +00:00
=Lsp-emmy= requires a working java installation in the path as well as the path to the LSP server jar.
The java path and the path to the server executable can be configured as is shown below:
#+BEGIN_SRC elisp
2019-11-12 03:29:50 +00:00
(lua :variables
lua-backend 'lsp-emmy
2019-11-12 03:29:50 +00:00
lua-lsp-emmy-jar-path "~/.emacs.d/EmmyLua-LS-all.jar" ; default path
lua-lsp-emmy-java-path "java" ; default path
2019-11-12 03:29:50 +00:00
lua-lsp-emmy-enable-file-watchers t) ; enabled default
#+END_SRC
2019-11-12 03:29:50 +00:00
*** Lua mode
This backend provides support via pure emacs packages. It requires less setup than a full blown LSP setup
but also provides less features. To enable it just set the =lua-backend= to =nil=.
2019-11-12 03:29:50 +00:00
* Key bindings
2019-11-12 03:29:50 +00:00
** LSP
The default key bindings for the LSP implementations are defined and documented in
the [[file:../../+tools/lsp/README.org][LSP layer]].
2015-06-10 16:44:30 +00:00
** Commands
| Key binding | Description |
2015-06-10 16:44:30 +00:00
|-------------+--------------------------------------------|
| ~SPC m d~ | lookup thing at point in lua documentation |
| ~SPC m s b~ | send buffer contents to REPL |
| ~SPC m s f~ | send current function to REPL |
| ~SPC m s l~ | send current line to REPL |
| ~SPC m s r~ | send current region to REPL |
| ~SPC m '~ | open repl buffer |