dotfiles/emacs/.emacs.d/config/init-js.el

47 lines
987 B
EmacsLisp

;; -*- lexical-binding: t; -*-
;; node version manager
(use-package nvm
:commands (nvm-use
nvm-use-for
nvm-use-for-buffer
nvm--installed-versions)
:init
(defun nvm (version)
(interactive (list
(completing-read "Node version: "
(mapcar #'car
(nvm--installed-versions)))))
(nvm-use version)))
(use-package json-mode
:commands (json-mode)
:mode ("\\.json\\'")
:custom
(js-indent-level 2))
(use-package jq-mode
:commands (jq-interactively))
(use-package js
:straight (:type built-in)
:defer t
:custom
(js-indent-level 2))
(use-package js-comint
:commands (run-js)
:config
(js-do-use-nvm)
:general
(js-mode-map "C-c M-j" #'run-js
"C-x C-e" #'js-send-last-sexp
"C-c C-k" #'js-send-buffer
"C-c M-z" #'js-send-buffer-and-go))
(use-package typescript-mode
:custom
(typescript-indent-level 2))
(provide 'init-js)