summaryrefslogtreecommitdiff
path: root/emacs/inits/20-programming.el
diff options
context:
space:
mode:
authortslil clingman <>2021-03-22 11:48:45 -0400
committertslil clingman <>2021-03-22 11:49:55 -0400
commit341b0db7ad500995167bfd8032db4a93a1434489 (patch)
tree1d6c1adba43d54c959f21083aae46fb7be86a1b3 /emacs/inits/20-programming.el
parent6df8edee472dbdcc67b7eb7d423d518f3e401563 (diff)
Collected changes for Zig, Gemini, theming
Diffstat (limited to 'emacs/inits/20-programming.el')
-rw-r--r--emacs/inits/20-programming.el202
1 files changed, 116 insertions, 86 deletions
diff --git a/emacs/inits/20-programming.el b/emacs/inits/20-programming.el
index 3dffd5c..69dae3a 100644
--- a/emacs/inits/20-programming.el
+++ b/emacs/inits/20-programming.el
@@ -1,4 +1,4 @@
-;; Time-stamp: <2021-01-07 00:32:16 (tslil@bison)>
+;; Time-stamp: <2021-03-17 14h14 EDT (hobbies)>
;; -----------------------------------------------------------------------------
;; General setup
@@ -47,7 +47,8 @@
(use-package comment-dwim-2
:ensure t
:bind (("M-;" . comment-dwim-2))
- :config (setq comment-multi-line t))
+ :config (setq comment-multi-line t
+ comment-style 'extra-line))
(use-package aggressive-indent
:ensure t
@@ -67,84 +68,7 @@
electric-pair-skip-whitespace t
electric-pair-inhibit-predicate 'electric-pair-default-inhibit))
-(use-package js-comint
- :ensure t
- :defer t
- :config
- (setq js-comint-program-command "node"
- js-comint-program-arguments nil))
-
-(use-package js2-mode
- :ensure t
- :defer t
- :after js-comint
- :mode "\\.js$"
- :bind (:map js2-mode-map
- ("TAB" . js2-indent-line)
- ("C-x C-e" . js-send-last-sexp)
- ("C-c C-b" . js-send-buffer)
- ("C-c C-l" . js-load-file))
- :hook (js2-mode . (lambda ()
- (auto-revert-mode -1)
- (yas-minor-mode-on))))
-
-(use-package nodemcu-mode
- :ensure t
- :defer t
- :config
- (setq nodemcu-default-keybindings t
- nodemcu-port "/dev/ttyUSB0"
- nodemcu-backend "nodemcu-uploader")
-
- (defun nodemcu-better-upload-current-file (&optional noreset)
- (interactive "P")
- (let ((proc (get-process "nodemcu-terminal")))
- (when proc
- (delete-process proc))
- (shell-command
- (nodemcu--get-command "upload" (file-name-nondirectory (buffer-file-name))))
- (unless noreset
- (shell-command
- (nodemcu--get-command "node restart"))
- (when proc
- (nodemcu-terminal))))))
-
-(use-package lua-mode
- :after nodemcu-mode
- :ensure t
- :defer t
- :bind (:map lua-mode-map
- ("C-x C-e" . lua-send-current-line)
- ("C-c C-d" . lua-send-defun)
- ("C-c C-e" . lua-send-region)
- ("C-c C-u" . nodemcu-better-upload-current-file)
- ("C-c C-t" . nodemcu-terminal)
- ("M-n" . lua-forward-sexp)
- ("M-p" . lua-backwards-to-block-begin-or-end))
- :hook (lua-mode . (lambda ()
- (require 'nodemcu-mode)
- (use-package company-lua :ensure t :demand)
- (nodemcu-mode 1)
- (add-to-list 'company-backends 'company-lua))))
-
-(use-package verilog-mode
- :ensure t
- :defer t
- :mode "\\.vl$"
- :hook (verilog-mode . (lambda ()
- (setq verilog-tool 'verilog-compiler)
- (verilog-set-compile-command)))
- :config
- (setq verilog-compiler "iverilog"
- verilog-tool 'verilog-compiler))
-
-(use-package gforth
- :commands forth-mode
- :mode (("\\.fs$" . forth-mode)
- ("\\.fb$" . forth-block-mode)
- ("\\.4th$" . forth-mode)))
-
-(use-package clojure-mode
+(use-package lsp-mode
:ensure t
:defer t)
@@ -278,10 +202,6 @@
;; -----------------------------------------------------------------------------
;; Rust
-(use-package lsp-mode
- :ensure t
- :defer t)
-
(use-package cargo
:ensure t
:defer t)
@@ -329,5 +249,115 @@
:init
(advice-add 'python-mode :before 'elpy-enable)
:config
- (setq python-shell-interpreter "python3"
- python-indent-offset 2))
+ (setq python-shell-interpreter "python3")
+ (setq-default python-indent-offset 4))
+
+
+;; -----------------------------------------------------------------------------
+;; Zig
+
+(use-package zig-mode
+ :ensure t
+ :defer t
+ :hook (zig-mode . (lambda () (lsp)))
+ :bind (:map zig-mode-map
+ ("M-," . lh-backward-delim)
+ ("M-." . lh-forward-delim)
+ ("M-/" . lh-matching-delim)
+ ("M-p" . beginning-of-defun)
+ ("M-n" . end-of-defun)
+ ("C-c C-c" . zig-compile)
+ ("C-c C-r" . zig-run))
+ :config
+ (require 'lsp)
+ (add-to-list 'lsp-language-id-configuration '(zig-mode . "zig"))
+ (lsp-register-client
+ (make-lsp-client
+ :new-connection (lsp-stdio-connection "~/prog/zig/zls/zig-cache/bin/zls")
+ :major-modes '(zig-mode)
+ :server-id 'zls)))
+
+
+;; -------------------------------------------------------------------
+;; Misc languages
+
+(use-package js-comint
+ :ensure t
+ :defer t
+ :config
+ (setq js-comint-program-command "node"
+ js-comint-program-arguments nil))
+
+(use-package js2-mode
+ :ensure t
+ :defer t
+ :after js-comint
+ :mode "\\.js$"
+ :bind (:map js2-mode-map
+ ("TAB" . js2-indent-line)
+ ("C-x C-e" . js-send-last-sexp)
+ ("C-c C-b" . js-send-buffer)
+ ("C-c C-l" . js-load-file))
+ :hook (js2-mode . (lambda ()
+ (auto-revert-mode -1)
+ (yas-minor-mode-on))))
+
+(use-package nodemcu-mode
+ :ensure t
+ :defer t
+ :config
+ (setq nodemcu-default-keybindings t
+ nodemcu-port "/dev/ttyUSB0"
+ nodemcu-backend "nodemcu-uploader")
+
+ (defun nodemcu-better-upload-current-file (&optional noreset)
+ (interactive "P")
+ (let ((proc (get-process "nodemcu-terminal")))
+ (when proc
+ (delete-process proc))
+ (shell-command
+ (nodemcu--get-command "upload" (file-name-nondirectory (buffer-file-name))))
+ (unless noreset
+ (shell-command
+ (nodemcu--get-command "node restart"))
+ (when proc
+ (nodemcu-terminal))))))
+
+(use-package lua-mode
+ :after nodemcu-mode
+ :ensure t
+ :defer t
+ :bind (:map lua-mode-map
+ ("C-x C-e" . lua-send-current-line)
+ ("C-c C-d" . lua-send-defun)
+ ("C-c C-e" . lua-send-region)
+ ("C-c C-u" . nodemcu-better-upload-current-file)
+ ("C-c C-t" . nodemcu-terminal)
+ ("M-n" . lua-forward-sexp)
+ ("M-p" . lua-backwards-to-block-begin-or-end))
+ :hook (lua-mode . (lambda ()
+ (require 'nodemcu-mode)
+ (use-package company-lua :ensure t :demand)
+ (nodemcu-mode 1)
+ (add-to-list 'company-backends 'company-lua))))
+
+(use-package verilog-mode
+ :ensure t
+ :defer t
+ :mode "\\.vl$"
+ :hook (verilog-mode . (lambda ()
+ (setq verilog-tool 'verilog-compiler)
+ (verilog-set-compile-command)))
+ :config
+ (setq verilog-compiler "iverilog"
+ verilog-tool 'verilog-compiler))
+
+(use-package gforth
+ :commands forth-mode
+ :mode (("\\.fs$" . forth-mode)
+ ("\\.fb$" . forth-block-mode)
+ ("\\.4th$" . forth-mode)))
+
+(use-package clojure-mode
+ :ensure t
+ :defer t)