summaryrefslogtreecommitdiff
path: root/lisp/web.el
diff options
context:
space:
mode:
authorMatthew Kosarek <mattkae@protonmail.com>2022-09-03 12:01:26 -0400
committerMatthew Kosarek <mattkae@protonmail.com>2022-09-03 12:01:26 -0400
commit6257322d751dc36eaaf509682da164f6aef3ff90 (patch)
tree1eca1af034f590e13dd3ff82588488cd8b2b3195 /lisp/web.el
parentf9893ba2781cf0b31044d1686632863278392fc8 (diff)
Big upgrade to javascript/typescript to use a lanugage server
Diffstat (limited to 'lisp/web.el')
-rw-r--r--lisp/web.el53
1 files changed, 53 insertions, 0 deletions
diff --git a/lisp/web.el b/lisp/web.el
new file mode 100644
index 0000000..ae8f96c
--- /dev/null
+++ b/lisp/web.el
@@ -0,0 +1,53 @@
+
+;;; Code:
+;; web mode
+(use-package web-mode
+ :mode ("\\.html\\'" . web-mode)
+ :config (setq
+ web-mode-markup-indent-offset 2
+ web-mode-code-indent-offset 2
+ web-mode-enable-current-element-highlight t
+ web-mode-enable-current-column-highlight t
+ ))
+(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
+(add-to-list 'auto-mode-alist '("\\.css\\'" . web-mode))
+(add-to-list 'auto-mode-alist '("\\.js\\'" . web-mode))
+(add-to-list 'auto-mode-alist '("\\.php\\'" . web-mode))
+(defun my-web-mode-hook ()
+ "Hooks for Web mode."
+ (setq web-mode-markup-indent-offset 2)
+ (setq web-mode-css-indent-offset 2)
+ (setq web-mode-code-indent-offset 2)
+)
+(add-hook 'web-mode-hook 'my-web-mode-hook)
+
+
+(require 'eglot)
+
+;; JavaScript
+(require 'js2-mode)
+(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
+(add-hook 'js2-mode-hook #'js2-imenu-extras-mode)
+
+(defun my-js2-mode-hook()
+ "Hooks for Javscript 2 Mode."
+ (setq js-indent-level 2)
+ (company-mode t)
+ (company-quickhelp-mode t)
+)
+(add-hook 'js2-mode-hook 'my-js2-mode-hook)
+(add-hook 'js2-mode-hook 'eglot-ensure)
+(push '("\\.js[x]?\\'" . js2-mode) auto-mode-alist)
+
+;; JS2-Refactor
+(use-package js2-refactor)
+(add-hook 'js2-mode-hook #'js2-refactor-mode)
+(js2r-add-keybindings-with-prefix "C-c C-r")
+
+;; Web goodies
+(autoload 'json-mode "json-mode"
+ "Use the json-mode package to provide 'json-mode on-demand."
+ t)
+
+(provide 'web)
+;;; web.el ends here