doomemacs/modules/lang/lua/config.el
Henrik Lissner 76cacb5bfe
💥 Rename def-package! -> use-package!
Calling this pivotal macro "def-package!" has frequently been a source
of confusion. It is a thin wrapper around use-package, and it should be
obvious that it is so. For this reason, and to match the naming
convention used with other convenience macros/wrappers, it is now
use-package!.

Also changes def-package-hook! -> use-package-hook!

The old macros are now marked obsolete and will be removed when straight
integration is merged.
2019-07-23 12:50:45 +02:00

46 lines
1.2 KiB
EmacsLisp

;;; lang/lua/config.el -*- lexical-binding: t; -*-
;; sp's default rules are obnoxious, so disable them
(provide 'smartparens-lua)
;;
;; Major modes
(use-package! lua-mode
:defer t
:init
;; lua-indent-level defaults to 3 otherwise. Madness.
(setq lua-indent-level tab-width)
:config
(set-lookup-handlers! 'lua-mode :documentation 'lua-search-documentation)
(set-electric! 'lua-mode :words '("else" "end"))
(set-repl-handler! 'lua-mode #'+lua/open-repl)
(set-company-backend! 'lua-mode '(company-lua company-yasnippet)))
(use-package! moonscript
:when (featurep! +moonscript)
:defer t
:config
(setq-hook! 'moonscript-mode-hook
moonscript-indent-offset tab-width)
(add-hook! 'moonscript-mode-hook
#'(+lua|moonscript-fix-single-quotes
+lua|moonscript-fontify-interpolation)))
;;
;;; Frameworks
(def-project-mode! +lua-love-mode
:modes '(moonscript-mode lua-mode markdown-mode json-mode)
:when #'+lua-love-project-root
:on-load
(progn
(set-project-type! 'love2d
:predicate #'+lua-love-project-root
:run #'+lua-love-build-command)
(map! :localleader
:map +lua-love-mode-map
"b" #'+lua/run-love-game)))