diff options
Diffstat (limited to 'user/emacs')
-rw-r--r-- | user/emacs/init.el | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el index 9268fb4d..275cd1b8 100644 --- a/user/emacs/init.el +++ b/user/emacs/init.el @@ -436,9 +436,9 @@ _p_rev _u_pper _=_: upper/lower _r_esolve :after evil :defer 2 :config (progn - (add-hook 'javascript-mode-hook (lambda () - (define-and-bind-quoted-text-object "slash" "/" "\\/" "\\/") - (push '(?\/ . ("/" . "/")) evil-surround-pairs-alist))) + (add-hook 'js-ts-mode-hook (lambda () + (define-and-bind-quoted-text-object "slash" "/" "\\/" "\\/") + (push '(?\/ . ("/" . "/")) evil-surround-pairs-alist))) (add-hook 'emacs-lisp-mode-hook (lambda () (push '(?` . ("`" . "'")) evil-surround-pairs-alist))) (global-evil-surround-mode +1))) @@ -448,7 +448,7 @@ _p_rev _u_pper _=_: upper/lower _r_esolve :after evil-surround :ghook ('LaTex-mode-hook #'embrace-LaTeX-mode-hook) :ghook ('org-mode-hook #'embrace-org-mode-hook) - :ghook ('ruby-mode-hook #'embrace-ruby-mode-hook) + :ghook ('ruby-ts-mode-hook #'embrace-ruby-mode-hook) :ghook ('emacs-lisp-mode-hook #'embrace-emacs-lisp-mode-hook) :config (progn (setq evil-embrace-show-help-p nil) @@ -727,27 +727,46 @@ _p_rev _u_pper _=_: upper/lower _r_esolve ;;; Major modes +(setq major-mode-remap-alist '((c-mode . c-ts-mode) + (c++-mode . c++-ts-mode) + (c-or-c++-mode . c-or-c++-ts-mode) + (cmake-mode . cmake-ts-mode) + (csharp-mode . csharp-ts-mode) + (dockerfile-mode . dockerfile-ts-mode) + (java-mode . java-ts-mode) + (python-mode . python-ts-mode) + (ruby-mode . ruby-ts-mode) + (toml-mode . toml-ts-mode) + (yaml-mode . yaml-ts-mode))) + ;;;; golang (use-package go-mode :defer t) +(add-to-list 'major-mode-remap-alist '(go-mode . go-ts-mode)) ;;;; rust (use-package rustic :mode (("\\.rs\\'" . rustic-mode)) + :if (package-installed-p 'rustic) :config (progn (setq rustic-format-on-save t) (with-eval-after-load 'flycheck (add-to-list 'flycheck-checkers 'rustic-clippy)))) +(add-to-list 'major-mode-remap-alist '(rust-mode . rust-ts-mode)) ;;;; js (setq js-indent-level 2 js-enabled-frameworks '(javascript)) +(add-to-list 'major-mode-remap-alist '(js-mode . js-ts-mode)) +(add-to-list 'major-mode-remap-alist '(json-mode . json-ts-mode)) ;;;; typescript (use-package typescript-mode - :mode (("\\.tsx\\'" . typescript-mode)) + :mode (("\\.tsx\\'" . tsx-ts-mode)) :config (progn - (setq typescript-indent-level 2))) + (setq typescript-indent-level 2 + typescript-ts-mode-indent-offset 2))) +(add-to-list 'major-mode-remap-alist '(typescript-mode . typescript-ts-mode)) (autoload 'ansi-color-apply-on-region "ansi-color") (defun colourise-compilation-buffer () @@ -852,6 +871,7 @@ _p_rev _u_pper _=_: upper/lower _r_esolve :defer t :config (progn (setq css-indent-offset 2))) +(add-to-list 'major-mode-remap-alist '(css-mode . css-ts-mode)) (use-package web-mode :mode (("\\.html?\\'" . web-mode) @@ -1017,12 +1037,12 @@ _p_rev _u_pper _=_: upper/lower _r_esolve "gd" #'xref-find-definitions "gr" #'xref-find-references "C-t" #'xref-pop-marker-stack) - :ghook ('(typescript-mode-hook - dockerfile-mode-hook - yaml-mode-hook - js-mode-hook - css-mode-hook - go-mode-hook + :ghook ('(typescript-ts-mode-hook + dockerfile-ts-mode-hook + yaml-ts-mode-hook + js-ts-mode-hook + css-ts-mode-hook + go-ts-mode-hook lua-mode-hook scss-mode-hook html-mode-hook @@ -1047,16 +1067,16 @@ _p_rev _u_pper _=_: upper/lower _r_esolve (use-package add-node-modules-path :config (setq add-node-modules-max-depth 6) - :ghook ('(feature-mode-hook js2-mode-hook json-mode-hook typescript-mode-hook) #'add-node-modules-path)) + :ghook ('(feature-mode-hook js2-mode-hook json-ts-mode-hook typescript-ts-mode-hook) #'add-node-modules-path)) ;;;; Reformat on save (use-package format-all :defer 10 :ghook ('(clojure-mode-hook - dockerfile-mode-hook + dockerfile-ts-mode-hook emacs-lisp-mode-hook - json-mode-hook + json-ts-mode-hook markdown-mode-hook sql-mode-hook toml-mode-hook)) |