summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/json.el8
-rw-r--r--lisp/web.el34
2 files changed, 20 insertions, 22 deletions
diff --git a/lisp/json.el b/lisp/json.el
new file mode 100644
index 0000000..f65b7b8
--- /dev/null
+++ b/lisp/json.el
@@ -0,0 +1,8 @@
+
+;;; Code:
+(autoload 'json-mode "json-mode"
+ "Use the json-mode package to provide 'json-mode on-demand."
+ t)
+
+(provide 'json)
+;;; json.el ends here
diff --git a/lisp/web.el b/lisp/web.el
index c78d40e..a161e0f 100644
--- a/lisp/web.el
+++ b/lisp/web.el
@@ -6,6 +6,7 @@
:config (setq
web-mode-markup-indent-offset 2
web-mode-code-indent-offset 2
+ web-mode-css-indent-offset 2
web-mode-enable-current-element-highlight t
web-mode-enable-current-column-highlight t
))
@@ -13,50 +14,41 @@
(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)
;; JavaScript
(require 'js2-mode)
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
+(push '("\\.js[x]?\\'" . js2-mode) auto-mode-alist)
(add-hook 'js2-mode-hook #'js2-imenu-extras-mode)
-(defun my-js2-mode-hook()
+(defun setup-js2-mode()
"Hooks for Javscript 2 Mode."
(setq js-indent-level 2)
(company-mode t)
(company-quickhelp-mode t)
+ (smartparens-mode 1)
)
-(add-hook 'js2-mode-hook 'my-js2-mode-hook)
-(add-hook 'js2-mode-hook #'smartparens-mode)
-(push '("\\.js[x]?\\'" . js2-mode) auto-mode-alist)
-(define-key js2-mode-map (kbd "M-.") nil)
-(add-hook 'js2-mode-hook (lambda ()
- (add-hook 'xref-backend-functions #'xref-js2-xref-backend nil t)))
+(add-hook 'js2-mode-hook 'setup-js2-mode)
(setq js2-highlight-level 3)
(setq js2-idle-timer-delay 0.1)
;; JS2-Refactor
(use-package js2-refactor)
(add-hook 'js2-mode-hook #'js2-refactor-mode)
-(defun keybind-setup()
+(defun js2-refactor-keybind-setup()
"Set up the keybinds."
(local-set-key [f2] 'js2r-rename-var)
)
-(add-hook 'js2-mode-hook 'keybind-setup)
+(add-hook 'js2-mode-hook 'js2-refactor-keybind-setup)
;; Typescript
(defun setup-ts-mode()
(interactive)
- (typescript-indent-level 2)
+ (setq typescript-indent-level 2)
(company-mode t)
(company-quickhelp-mode t)
+ (smartparens-mode 1)
)
(define-derived-mode typescriptreact-mode web-mode "TypescriptReact"
@@ -67,7 +59,10 @@
(add-hook 'typescript-mode-hook #'setup-ts-mode)
(add-hook 'typescriptreact-mode-hook #'setup-ts-mode)
+;; Package management
(use-package eglot
+ :custom
+ (eglot-autoshutdown t)
:ensure t
:defer 3
:hook
@@ -79,11 +74,6 @@
eglot-server-programs
:test #'equal)
-;; Web goodies
-(autoload 'json-mode "json-mode"
- "Use the json-mode package to provide 'json-mode on-demand."
- t)
-
;; Ignore certain directories in projectile
(with-eval-after-load 'projectile
(add-to-list 'projectile-globally-ignored-directories "node_modules")