11# Introduction
22
33` import-js ` is a tool to automatically import dependencies in your JavaScript
4- project. Use it in Vim or Emacs by placing your cursor on a variable and hit
5- ` <leader>j ` (Vim), or ` (M-x) import-js-import ` (Emacs).
4+ project. Use it in Vim, Emacs, or Sublime by placing your cursor on a variable
5+ and hit ` <leader>j ` (Vim), or ` (M-x) import-js-import ` (Emacs), or select
6+ "ImportJS: import word under cursor" from the Command Palette (Sublime).
67
78![ Demo of import-js in action] ( https://raw.github.com/trotzig/import-js/master/import-js-demo.gif )
89
910## Editor support
1011
1112import-js comes with plugins for the following editors:
1213
13- - [ Emacs (experimental)] ( EMACS.md ) (Thanks to @kevin .kehl!)
14+ - [ Emacs (experimental)] ( EMACS.md ) (Thanks to
15+ [ @kevin .kehl] ( https://github.com/kevin.kehl ) !)
1416- [ Vim] ( VIM.md )
17+ - [ Sublime] ( Sublime.md ) (Thanks to
18+ [ @janpaul123 ] ( https://github.com/janpaul123 ) )
1519- [ (your editor here?)] ( CONTRIBUTING.md )
1620
1721Detailed instructions on how to install import-js can be found in the editor
@@ -47,8 +51,9 @@ document.createElement(new Button({ text: 'Save' }).toDOMElement());
4751At this point, ` Button ` is undefined. We need to import it. If you are used to
4852doing this manually, this involves figuring out the path to the JavaScript
4953module that defines ` Button ` . With import-js, you instead place your cursor on
50- the word "Button", then hit ` <leader>j ` (Vim) or ` (M-x) import-js-import `
51- (Emacs). The file buffer will now change to the following:
54+ the word "Button", then hit ` <leader>j ` (Vim), ` (M-x) import-js-import `
55+ (Emacs), or choose "ImportJS: import word under cursor" (Sublime). The file
56+ buffer will now change to the following:
5257
5358``` js
5459var Button = require (' components/button' );
@@ -72,8 +77,8 @@ Since import-js is pretty good at finding JS modules, it makes sense that
7277there's an option to open/go to a file rather than import it. This is similar
7378to VIM's built in [ "Open file under
7479cursor"] ( http://vim.wikia.com/wiki/Open_file_under_cursor ) . Use it by placing
75- the cursor on a variable and hit ` <leader>g ` (Vim) or ` (M-x) import-js-goto `
76- (Emacs).
80+ the cursor on a variable and hit ` <leader>g ` (Vim), ` (M-x) import-js-goto `
81+ (Emacs), or choose "ImportJS: goto module" (Sublime) .
7782
7883## Things to note
7984
@@ -82,7 +87,8 @@ the cursor on a variable and hit `<leader>g` (Vim) or `(M-x) import-js-goto`
8287 ` var ` /` const ` /` let ` /` import ` (configurable through the ` declaration_keyword `
8388 option)
8489- As part of resolving an import, all imports will be sorted
85- - The Vim plugin is written in Ruby. You need a [ Vim with Ruby support] ( VIM.md ) .
90+ - The core of the plugin is written in Ruby. If you are using Vim, you need a
91+ [ Vim with Ruby support] ( VIM.md ) .
8692
8793## Configuration
8894
0 commit comments