aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2019-02-06 00:27:28 -0800
committerGravatar Tom Willemse2019-02-06 00:27:28 -0800
commit7dd202a015a25a4642b0463ec0923acb23baacf9 (patch)
treef2742111615fe72d9aefcb5ae3ef67c8c9a1ca51
parent4ca39f722f3ea7fd6c00895b70024244fc96040b (diff)
downloademacs-config-7dd202a015a25a4642b0463ec0923acb23baacf9.tar.gz
emacs-config-7dd202a015a25a4642b0463ec0923acb23baacf9.zip
Add ‘js2-mode’ configuration
-rw-r--r--oni-js2-mode.el61
1 files changed, 61 insertions, 0 deletions
diff --git a/oni-js2-mode.el b/oni-js2-mode.el
new file mode 100644
index 0000000..68370ae
--- /dev/null
+++ b/oni-js2-mode.el
@@ -0,0 +1,61 @@
+;;; oni-js2-mode.el --- js2-mode configuration -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019 Tom Willemse
+
+;; Author: Tom Willemse <tom@ryuslash.org>
+;; Keywords: local
+;; Version: 20190206002649
+;; Package-Requires: (js2-mode js2-refactor flycheck company fill-column-indicator tern company-tern fic-mode)
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; My `js2-mode' configuration.
+
+;;; Code:
+
+(require 'company)
+(require 'js2-mode)
+(require 'js2-refactor)
+(require 'whitespace)
+
+(defun oni-js2-mode-whitespace-mode ()
+ "Enable whitespace mode with only tabs showing."
+ (setq-local whitespace-style '(face tabs))
+ (whitespace-mode))
+
+(setq js2-include-node-externs t)
+(setq js2-strict-trailing-comma-warning nil)
+(setq js2-strict-missing-semi-warning nil)
+(setq js2-basic-offset 2)
+
+(add-hook 'js2-mode-hook 'company-mode)
+(add-hook 'js2-mode-hook 'electric-pair-local-mode)
+(add-hook 'js2-mode-hook 'fci-mode)
+(add-hook 'js2-mode-hook 'fic-mode)
+(add-hook 'js2-mode-hook 'flycheck-mode)
+(add-hook 'js2-mode-hook 'js2-refactor-mode)
+(add-hook 'js2-mode-hook 'oni-js2-mode-whitespace-mode)
+(add-hook 'js2-mode-hook 'subword-mode)
+(add-hook 'js2-mode-hook 'tern-mode)
+
+(js2r-add-keybindings-with-prefix "C-c r")
+
+(add-to-list 'company-backends 'company-tern)
+
+;;;###autoload(with-eval-after-load 'js2-mode (require 'oni-js2-mode))
+
+(provide 'oni-js2-mode)
+;;; oni-js2-mode.el ends here