Standardize some key bindings for javascript layer
This commit is contained in:
parent
fef7372be2
commit
fe8e8c09fd
|
@ -101,14 +101,13 @@ Bindings should match the plain emacs assignments.
|
||||||
### Auto-complete and documentation (tern)
|
### Auto-complete and documentation (tern)
|
||||||
|
|
||||||
Key Binding | Description
|
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 c</kbd> | rename variable under the cursor using tern
|
||||||
<kbd>SPC m f</kbd> | jump to definition for the given name
|
<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> | 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
|
<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
|
|
||||||
|
|
||||||
[js2-mode]: https://github.com/mooz/js2-mode
|
[js2-mode]: https://github.com/mooz/js2-mode
|
||||||
[js2-refactor]: https://github.com/magnars/js2-refactor.el
|
[js2-refactor]: https://github.com/magnars/js2-refactor.el
|
||||||
|
|
|
@ -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)))
|
:init (add-hook 'js2-mode-hook (lambda () (tern-mode t)))
|
||||||
:config
|
:config
|
||||||
(progn
|
(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 "mc" 'tern-rename-variable)
|
||||||
(evil-leader/set-key-for-mode 'js2-mode "mt" 'tern-get-type)
|
(evil-leader/set-key-for-mode 'js2-mode "md" 'tern-get-docs)
|
||||||
(evil-leader/set-key-for-mode 'js2-mode "mg" '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 ()
|
(defun javascript/init-tern-auto-complete ()
|
||||||
(use-package tern-auto-complete
|
(use-package tern-auto-complete
|
||||||
|
|
Loading…
Reference in a new issue