22 lines
504 B
EmacsLisp
22 lines
504 B
EmacsLisp
(defun lua-format-buffer ()
|
|
"Run stylua."
|
|
(interactive)
|
|
(run-command-on-buffer "stylua" "--search-parent-directories" "--stdin-filepath" buffer-file-name "-")
|
|
)
|
|
|
|
(use-package lua-mode
|
|
:mode
|
|
(("\\.lua\\'" . lua-mode)
|
|
("\\.rockspec\\'" . lua-mode))
|
|
:commands lua-mode
|
|
:hook (
|
|
(lua-mode . (lambda ()
|
|
(add-hook 'before-save-hook 'lua-format-buffer nil 'local)
|
|
))
|
|
)
|
|
:custom
|
|
(lua-indent-level 4)
|
|
)
|
|
|
|
(provide 'lang-lua)
|