Add lua configuration layer

This commit is contained in:
mkcode 2015-01-14 14:31:40 +11:00 committed by syl20bnr
parent 8582003292
commit 7bc2d77a56
3 changed files with 66 additions and 0 deletions

View file

@ -0,0 +1,45 @@
# Lua contribution layer for Spacemacs
![logo](img/lua.gif)
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc/generate-toc again -->
**Table of Contents**
- [Lua contribution layer for Spacemacs](#lua-contribution-layer-for-spacemacs)
- [Description](#description)
- [Install](#install)
- [Key Bindings](#key-bindings)
<!-- markdown-toc end -->
## Description
This layer adds support for editing Lua.
Features:
- Editing lua files using [lua-mode][]
- Sending code to a lua REPL
## Install
To use this contribution add it to your `~/.spacemacs`
```elisp
(setq-default dotspacemacs-configuration-layers '(lua)
"List of contribution to load."
)
```
## Key Bindings
### commands
Key Binding | Description
---------------------|------------------------------------------------------------
<kbd>SPC m d</kbd> | lookup thing at point in lua documentation
<kbd>SPC m s b</kbd> | send buffer contents to REPL
<kbd>SPC m s f</kbd> | send current function to REPL
<kbd>SPC m s r</kbd> | send current region to REPL
<kbd>SPC m s l</kbd> | send current line to REPL
[lua-mode]: https://github.com/immerrr/lua-mode

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

View file

@ -0,0 +1,21 @@
(defvar lua-packages
'(
lua-mode
)
"List of all packages to install and/or initialize. Built-in packages
which require an initialization must be listed explicitly in the list.")
(defun lua/init-lua-mode ()
(use-package lua-mode
:defer t
:mode ("\\.lua\\'" . lua-mode)
:interpreter ("lua" . lua-mode)
:config
(progn
(setq lua-indent-level 2
lua-indent-string-contents t)
(evil-leader/set-key-for-mode 'lua-mode "md" 'lua-search-documentation)
(evil-leader/set-key-for-mode 'lua-mode "msb" 'lua-send-buffer)
(evil-leader/set-key-for-mode 'lua-mode "msf" 'lua-send-defun)
(evil-leader/set-key-for-mode 'lua-mode "msl" 'lua-send-current-line)
(evil-leader/set-key-for-mode 'lua-mode "msr" 'lua-send-region))))