Added Tern + more js2-mode integration.
This commit is contained in:
parent
f630180636
commit
67f2a66a85
20
README.md
20
README.md
|
@ -1365,6 +1365,23 @@ Test commands (start with `m t` or `m T`):
|
|||
`<SPC> m g` | go to definition using [emacs-jedi][jedi]
|
||||
`<SPC> m p` | add a breakpoint
|
||||
|
||||
#### JavaScript
|
||||
|
||||
[js2-mode][] will activate for all `*.js` files, along with
|
||||
[tern-auto-complete][] which will provide the best JavaScript
|
||||
completion currently available. Just make sure you have the [tern][]
|
||||
NPM module installed.
|
||||
|
||||
Tern includes the following key bindings:
|
||||
|
||||
Key Binding | Description
|
||||
------------------|------------------------------------------------------------
|
||||
`M-.` | jump to the definition of the thing under the cursor.
|
||||
`M-,` | brings you back to last place you were when you pressed M-..
|
||||
`C-c C-r` | rename the variable under the cursor.
|
||||
`C-c C-c` | find the type of the thing under the cursor.
|
||||
`C-c C-d` | find docs of the thing under the cursor. Press again to open the associated URL (if any).
|
||||
|
||||
#### R (ESS)
|
||||
|
||||
**Important**:
|
||||
|
@ -1517,3 +1534,6 @@ Thank you to the whole Emacs community from core developers to elisp hackers!
|
|||
[issues]: https://github.com/syl20bnr/spacemacs/issues
|
||||
[vundle]: https://github.com/gmarik/Vundle.vim
|
||||
[anzu]: https://github.com/syohex/emacs-anzu
|
||||
[js2-mode]: https://github.com/mooz/js2-mode
|
||||
[tern-auto-complete]: https://github.com/marijnh/tern/blob/master/emacs/tern-auto-complete.el
|
||||
[tern]: http://ternjs.net/
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
string-edit
|
||||
subword
|
||||
tagedit
|
||||
tern-auto-complete
|
||||
undo-tree
|
||||
visual-regexp-steroids
|
||||
volatile-highlights
|
||||
|
@ -1342,22 +1343,9 @@ of 2 characters. If INSERT? is not nil then the first key pressed is inserted
|
|||
|
||||
(defun spacemacs/init-js2-mode ()
|
||||
(use-package js2-mode
|
||||
:commands (js2-minor-mode
|
||||
ac-js2-mode)
|
||||
:commands (js2-minor-mode)
|
||||
:init
|
||||
(progn
|
||||
(add-hook 'js-mode-hook 'js2-minor-mode)
|
||||
(add-hook 'js2-mode-hook 'ac-js2-mode)
|
||||
;; the following manually installed packages are a hack because of unhealthy
|
||||
;; dependencies between js2-mode, ac-js2, skewer-mode etc...
|
||||
(use-package ac-js2
|
||||
:ensure ac-js2
|
||||
:defer t)
|
||||
(puthash 'ac-js2 'spacemacs spacemacs-all-packages)
|
||||
(use-package js2-refactor
|
||||
:ensure js2-refactor
|
||||
:defer t)
|
||||
(puthash 'js2-refactor 'spacemacs spacemacs-all-packages))))
|
||||
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))))
|
||||
|
||||
(defun spacemacs/init-json-mode ()
|
||||
(use-package json-mode
|
||||
|
@ -1766,6 +1754,14 @@ of 2 characters. If INSERT? is not nil then the first key pressed is inserted
|
|||
(add-hook 'html-mode-hook (lambda () (tagedit-mode 1)))
|
||||
(spacemacs//diminish tagedit-mode " Ⓣ"))))
|
||||
|
||||
(defun spacemacs/init-tern-auto-complete ()
|
||||
(use-package tern-auto-complete
|
||||
:defer t
|
||||
:init
|
||||
(progn
|
||||
(tern-ac-setup)
|
||||
(add-hook 'js2-mode-hook (lambda () (tern-mode t))))))
|
||||
|
||||
(defun spacemacs/init-undo-tree ()
|
||||
(use-package undo-tree
|
||||
:defer t
|
||||
|
|
Loading…
Reference in a new issue