doomemacs/modules/module-lua.el

55 lines
1.7 KiB
EmacsLisp
Raw Normal View History

2015-06-15 09:06:10 +02:00
;;; module-lua.el --- lua + Love2D
(use-package lua-mode
:mode "\\.lua$"
:interpreter "lua"
:init
2016-03-28 21:39:13 -04:00
(define-repl! lua-mode narf/inf-lua)
2016-04-06 03:23:11 -04:00
(define-company-backend! lua-mode (yasnippet))
(add-hook 'lua-mode-hook 'flycheck-mode)
2016-02-26 00:08:41 -05:00
(after! company-dict
2016-03-03 01:35:29 -05:00
(add-to-list 'company-dict-minor-mode-list 'love-mode))
2016-03-23 11:59:06 -04:00
(add-hook! lua-mode
(electric-indent-local-mode +1)
(setq narf-electric-indent-words '("else" "end")))
2016-03-28 21:39:13 -04:00
:config
(sp-with-modes '(lua-mode)
;; disable defaults
(sp-local-pair "if" nil :actions :rem)
(sp-local-pair "while" nil :actions :rem)
(sp-local-pair "function" nil :actions :rem)
(sp-local-pair "then " " end")
(sp-local-pair "do " " end")
(sp-local-pair "then" "end" :when '(("RET")) :post-handlers '("||\n[i]"))
(sp-local-pair "do" "end" :when '(("RET")) :post-handlers '("||\n[i]"))
2016-03-23 11:59:06 -04:00
2016-03-31 03:22:34 -04:00
;; block functions
(sp-local-pair "function" "end" :when '(sp-point-after-bol-p) :post-handlers '(" |\n[i]"))
;; inline functions
(sp-local-pair "function " " end" :unless '(sp-point-after-bol-p))))
2015-06-15 09:06:10 +02:00
(define-minor-mode love-mode
"Buffer local minor mode for Love2D"
:init-value nil
2015-07-17 12:08:21 +02:00
:lighter ""
2015-08-13 12:14:41 -04:00
:keymap (make-sparse-keymap)
(add-yas-minor-mode! 'love-mode))
(associate! love-mode
:in (lua-mode markdown-mode json-mode)
:files ("main.lua" "conf.lua"))
(define-builder! love-mode "open -a love.app '%s'" "main.lua")
2015-06-15 09:06:10 +02:00
2016-01-29 07:04:14 -05:00
(define-minor-mode hammerspoon-mode
:init-value nil
:lighter " hammer"
:keymap (make-sparse-keymap)
2016-01-29 07:04:14 -05:00
(add-yas-minor-mode! 'hammerspoon-mode))
(associate! hammerspoon-mode
:in (lua-mode markdown-mode)
:match "/\\.?hammerspoon/.+\\.lua$")
(define-builder! hammerspoon-mode "open hammerspoon://reload")
2016-01-29 07:04:14 -05:00
2015-06-15 09:06:10 +02:00
(provide 'module-lua)
;;; module-lua.el ends here