This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+tools/import-js/README.org

48 lines
1.5 KiB
Org Mode
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#+TITLE: import-js layer
* Table of Contents :TOC_4_gh:noexport:
- [[#description][Description]]
- [[#features][Features:]]
- [[#install][Install]]
- [[#key-bindings][Key bindings]]
* Description
This layer adds support for [[https://github.com/Galooshi/import-js][import-js]]
** Features:
- Import Javascript/Typescript modules to buffer
- Import missing modules and remove unused one
- Go to module location
* Install
To use this configuration layer, add it to your =~/.spacemacs=.
To install =import-js= globally:
#+BEGIN_SRC sh
$ npm install -g import-js
#+END_SRC
If that doesnt work you can also try installing =import-js= with =--unsafe-perm= tag
#+BEGIN_SRC sh
$ sudo npm install --unsafe-perm -g import-js
#+END_SRC
To enable it, set the layer variable =javascript-import-tool=, for example for
the =javascript= layer
#+BEGIN_SRC elisp
(javascript :variables javascript-import-tool 'import-js)
#+END_SRC
Once you have set this variable other layers =react= and =typescript= will also
enjoy this feature
* Key bindings
| Key binding | Description |
|-------------+---------------------------------------------------------------------|
| ~SPC m i i~ | Import the module for the variable under the cursor |
| ~SPC m i f~ | Import any missing modules and remove any modules that are not used |
| ~SPC m i g~ | Go to the module of the variable under cursor |