Skip to content

Commit

Permalink
Rename JSAddImport to JSAdd
Browse files Browse the repository at this point in the history
  • Loading branch information
sukima committed Apr 4, 2019
1 parent deb2189 commit ce080ac
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
32 changes: 26 additions & 6 deletions doc/vim-javascript-imports.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CONTENTS
2. Command .................... |:JSImport|
3. Mapping .................... |JavaScriptImportsMapping|
4. Configuration .............. |JavaScriptImportsConfig|
5. Adding Import Definitions... |:JSAddImport|
5. Adding Import Definitions... |:JSAdd| |JSAddImport()|
6. License .................... |JavaScriptImportsLicense|
7. Contributing ............... |JavaScriptImportsContributing|

Expand Down Expand Up @@ -119,24 +119,44 @@ Import Sorting
<

==============================================================================
5. Adding Import Definitions *:JSAddImport*
5. Adding Import Definitions *:JSAdd*

Import definitions can be added in two ways. Easiest is to use the
|:JSAddImport| command.
|:JSAdd| command.

>
:JSAddImport [IMPORT STATEMENT]
:JSAdd import [IMPORT NAMES] from [IMPORT FROM]
<
Example:
>
:JSAddImport import { foo } from 'bar'
:JSAdd import { foo } from bar
<
Will add the foo keyword and definition to the database and make it
available via the |:JSImport| command.

Because this command will parse the import statement doing this for a large set
of definitions could slow down Vim while it loads. To avoid a performance hit
for large sets you can alternatively add the definitions manually.
for large sets you can alternatively add the definitions manually with
|JSAddImportDefinition()|.

*JSAddImport()*

You can also call a function if it is more convinient with |JSAddImport()|.

>
:call JSAddImport('import [IMPORT NAMES] from [IMPORT FROM]')
<
Example:
>
:call JSAddImport('import { foo } from bar')
<
Will add the foo keyword and definition to the database and make it
available via the |:JSImport| command.

Because this function will parse the import statement doing this for a large
set of definitions could slow down Vim while it loads. To avoid a performance
hit for large sets you can alternatively add the definitions manually with
|JSAddImportDefinition()|.

*JSAddImportDefinition()*

Expand Down
2 changes: 1 addition & 1 deletion plugin/jsimports.vim
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if !empty(g:vim_javascript_imports_map)
execute "nnoremap " . g:vim_javascript_imports_map . " :call jsimports#run()<Cr>"
endif

command -nargs=1 JSAddImport call JSAddImport(<f-args>)
command -nargs=1 JSAdd call JSAddImport(<f-args>)
command -nargs=* -complete=customlist,jsimports#complete JSImport call jsimports#run(<f-args>)

" vim:sw=2 ts=2 et fdm=marker

0 comments on commit ce080ac

Please sign in to comment.