branch: elpa/zig-mode commit 2acd88f9369f1e2fc203e95d8437724d0384f5d7 Author: Marcio Giaxa <i...@mgxm.me> Commit: Marcio Giaxa <i...@mgxm.me>
add zig-mode-map with default keybinding `C-c C-b` runs `zig-compile` `C-c C-f` runs `zig-format-buffer` `C-c C-r` runs `zig-run` `C-c C-t` runs `zig-test-buffer` --- zig-mode.el | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/zig-mode.el b/zig-mode.el index 819b7fd..5100009 100644 --- a/zig-mode.el +++ b/zig-mode.el @@ -49,7 +49,6 @@ ;; zig CLI commands - (defun zig--run-cmd (cmd &optional source &rest args) "Use compile command to execute a zig CMD with ARGS if given. If given a SOURCE, execute the CMD on it." @@ -388,9 +387,21 @@ If given a SOURCE, execute the CMD on it." '("enum" "struct" "union")) `(("Fn" ,(zig-re-definition "fn") 1)))) +(defvar zig-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-c C-b") 'zig-compile) + (define-key map (kbd "C-c C-f") 'zig-format-buffer) + (define-key map (kbd "C-c C-r") 'zig-run) + (define-key map (kbd "C-c C-t") 'zig-test-buffer) + map) + "Keymap for Zig major mode.") + ;;;###autoload (define-derived-mode zig-mode prog-mode "Zig" - "A major mode for the Zig programming language." + "A major mode for the Zig programming language. + +\\{zig-mode-map}" + :group 'zig-mode (setq-local comment-start "// ") (setq-local comment-end "") (setq-local electric-indent-chars