Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Galooshi/vim-import-js
Vim plugin for ImportJS
https://github.com/Galooshi/vim-import-js
importjs javascript vim vim-plugin
Last synced: 4 days ago
JSON representation
Vim plugin for ImportJS
- Host: GitHub
- URL: https://github.com/Galooshi/vim-import-js
- Owner: Galooshi
- License: mit
- Created: 2016-04-12T03:59:30.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-02-23T13:55:11.000Z (over 3 years ago)
- Last Synced: 2024-08-01T16:56:34.258Z (3 months ago)
- Topics: importjs, javascript, vim, vim-plugin
- Language: Vim script
- Homepage:
- Size: 146 KB
- Stars: 159
- Watchers: 7
- Forks: 18
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
ImportJS helps you import JavaScript dependencies. Hit a keyboard shortcut
to automatically add `import x from 'y'` statements at the top of the file.![Demo of ImportJS in action](https://raw.github.com/galooshi/vim-import-js/master/demo.gif)
# Installation
ImportJS is meant to be used as a Pathogen plugin. Just `git clone` this repo
into the `bundles` folder and you are good to go!
```
git clone [email protected]:Galooshi/vim-import-js.git ~/.vim/bundle/vim-import-js
```## Dependencies
ImportJS works in [Vim](http://www.vim.org/) (version 8 and later) and
[Neovim](https://neovim.io/).You need import-js installed globally to use this plugin.
```sh
npm install -g import-js
```## Default mappings
By default, ImportJS attempts to set up the following mappings:
Mapping | Command | Description
------------|-----------------------|---------------------------------------------------------------------
`j` | `:ImportJSWord` | Import the module for the variable under the cursor.
`i` | `:ImportJSFix` | Import any missing modules and remove any modules that are not used.
`g` | `:ImportJSGoto` | Go to the module of the variable under the cursor.## Configuration
For `import-js` configuration see https://github.com/Galooshi/import-js#configuration## Troubleshooting
If you run into issues when using the plugin, adding some logging can help.
After starting up vim, and before you've imported anything, run this command:```
:call ch_logfile('channel_log.txt', 'w')
```After this, you should get useful information in `channel_log.txt`.