1
0
Fork 0

Unify JavaScript configuration in oni-js

This commit is contained in:
Tom Willemse 2019-02-24 20:02:21 -08:00
parent c871ddbc9d
commit b6220b1d6f

View file

@ -1,10 +1,10 @@
;;; oni-js2-mode.el --- js2-mode configuration -*- lexical-binding: t; -*- ;;; oni-js.el --- JavaScript configuration -*- lexical-binding: t; -*-
;; Copyright (C) 2019 Tom Willemse ;; Copyright (C) 2019 Tom Willemse
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 20190219001218 ;; Version: 20190224201011
;; Package-Requires: (oni-company js2-mode js2-refactor flycheck fill-column-indicator tern company-tern fic-mode) ;; Package-Requires: (oni-company js2-mode js2-refactor flycheck fill-column-indicator tern company-tern fic-mode)
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
@ -22,11 +22,12 @@
;;; Commentary: ;;; Commentary:
;; My `js2-mode' configuration. ;; JavaScript configuration.
;;; Code: ;;; Code:
(require 'company) (require 'company)
(require 'js)
(require 'js2-mode) (require 'js2-mode)
(require 'js2-refactor) (require 'js2-refactor)
(require 'whitespace) (require 'whitespace)
@ -34,23 +35,28 @@
(eval-when-compile (eval-when-compile
(require 'grep)) (require 'grep))
(defun oni-js2-mode-whitespace-mode () (defun oni-js-whitespace-mode ()
"Enable whitespace mode with only tabs showing." "Enable whitespace mode with only tabs showing."
(setq-local whitespace-style '(face tabs)) (setq-local whitespace-style '(face tabs))
(whitespace-mode)) (whitespace-mode))
(setq js-enabled-frameworks '(javascript))
(setq js2-include-node-externs t) (setq js2-include-node-externs t)
(setq js2-strict-trailing-comma-warning nil) (setq js2-strict-trailing-comma-warning nil)
(setq js2-strict-missing-semi-warning nil) (setq js2-strict-missing-semi-warning nil)
(setq js2-basic-offset 2) (setq js2-basic-offset 2)
(add-hook 'js-mode-hook 'electric-pair-local-mode)
(add-hook 'js-mode-hook 'electric-indent-local-mode)
(add-hook 'js2-mode-hook 'company-mode) (add-hook 'js2-mode-hook 'company-mode)
(add-hook 'js2-mode-hook 'electric-pair-local-mode) (add-hook 'js2-mode-hook 'electric-pair-local-mode)
(add-hook 'js2-mode-hook 'fci-mode) (add-hook 'js2-mode-hook 'fci-mode)
(add-hook 'js2-mode-hook 'fic-mode) (add-hook 'js2-mode-hook 'fic-mode)
(add-hook 'js2-mode-hook 'flycheck-mode) (add-hook 'js2-mode-hook 'flycheck-mode)
(add-hook 'js2-mode-hook 'js2-refactor-mode) (add-hook 'js2-mode-hook 'js2-refactor-mode)
(add-hook 'js2-mode-hook 'oni-js2-mode-whitespace-mode) (add-hook 'js2-mode-hook 'oni-js-whitespace-mode)
(add-hook 'js2-mode-hook 'subword-mode) (add-hook 'js2-mode-hook 'subword-mode)
(add-hook 'js2-mode-hook 'tern-mode) (add-hook 'js2-mode-hook 'tern-mode)
@ -58,7 +64,7 @@
(add-to-list 'company-backends 'company-tern) (add-to-list 'company-backends 'company-tern)
;;;###autoload(with-eval-after-load 'js2-mode (require 'oni-js2-mode)) ;;;###autoload(with-eval-after-load 'js2-mode (require 'oni-js))
;;;###autoload ;;;###autoload
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode)) (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
@ -67,5 +73,5 @@
(with-eval-after-load 'grep (with-eval-after-load 'grep
(add-to-list 'grep-files-aliases '("js" . "*.js *.jsx *.json"))) (add-to-list 'grep-files-aliases '("js" . "*.js *.jsx *.json")))
(provide 'oni-js2-mode) (provide 'oni-js)
;;; oni-js2-mode.el ends here ;;; oni-js.el ends here