Standardize some key bindings for javascript layer

This commit is contained in:
syl20bnr 2014-12-08 00:39:19 -05:00
parent fef7372be2
commit fe8e8c09fd
2 changed files with 13 additions and 15 deletions

View file

@ -100,15 +100,14 @@ Bindings should match the plain emacs assignments.
### Auto-complete and documentation (tern)
Key Binding | Description
--------------------|------------------------------------------------------------
<kbd>SPC m .</kbd> | jump to the definition of the thing under the cursor
<kbd>SPC m ,</kbd> | brings you back to last place you were when you pressed M-..
<kbd>SPC m c</kbd> | rename variable under the cursor using tern
<kbd>SPC m f</kbd> | jump to definition for the given name
<kbd>SPC m g</kbd> | find docs of the thing under the cursor. Press again to open the associated URL (if any)
<kbd>SPC m t</kbd> | find the type of the thing under the cursor
<kbd>SPC m w</kbd> | toggle js2-mode warnings and errors
Key Binding | Description
---------------------|------------------------------------------------------------
<kbd>SPC m c</kbd> | rename variable under the cursor using tern
<kbd>SPC m d</kbd> | find docs of the thing under the cursor. Press again to open the associated URL (if any)
<kbd>SPC m g</kbd> | jump to the definition of the thing under the cursor
<kbd>SPC m G</kbd> | jump to definition for the given name
<kbd>SPC m C-g</kbd> | brings you back to last place you were when you pressed M-..
<kbd>SPC m t</kbd> | find the type of the thing under the cursor
[js2-mode]: https://github.com/mooz/js2-mode
[js2-refactor]: https://github.com/magnars/js2-refactor.el

View file

@ -97,13 +97,12 @@ which require an initialization must be listed explicitly in the list.")
:init (add-hook 'js2-mode-hook (lambda () (tern-mode t)))
:config
(progn
(spacemacs/declare-prefix-for-mode 'js2-mode "mt" "tern")
(evil-leader/set-key-for-mode 'js2-mode "m." 'tern-find-definition)
(evil-leader/set-key-for-mode 'js2-mode "m," 'tern-pop-find-definition)
(evil-leader/set-key-for-mode 'js2-mode "mf" 'tern-find-definition-by-name)
(evil-leader/set-key-for-mode 'js2-mode "mc" 'tern-rename-variable)
(evil-leader/set-key-for-mode 'js2-mode "mt" 'tern-get-type)
(evil-leader/set-key-for-mode 'js2-mode "mg" 'tern-get-docs))))
(evil-leader/set-key-for-mode 'js2-mode "md" 'tern-get-docs)
(evil-leader/set-key-for-mode 'js2-mode "mg" 'tern-find-definition)
(evil-leader/set-key-for-mode 'js2-mode "mG" 'tern-find-definition-by-name)
(evil-leader/set-key-for-mode 'js2-mode (kbd "m C-g") 'tern-pop-find-definition)
(evil-leader/set-key-for-mode 'js2-mode "mt" 'tern-get-type))))
(defun javascript/init-tern-auto-complete ()
(use-package tern-auto-complete