r fs⏎
Turns into:
const fs = require('fs')
Also:
r path → const path = require('path')
r ../setup → const setup = require('../setup')
r path.join → const join = require('path').join
r React → const React = require('react')
v path → var path = require('path')
i path → import path from 'path'
i path.join → import { join } from 'path'
Semicolons are added if any other line in your buffer ends in a semicolon.
When using vim-plug, add this to your ~/.vimrc
:
Plug 'rstacruz/vim-node-import'
This plugin works swimmingly with vim-closer, which, if you write JavaScript, you should also have.
vim-node-import © 2015+, Rico Sta. Cruz. Released under the MIT License.
Authored and maintained by Rico Sta. Cruz with help from contributors (list).
ricostacruz.com · GitHub @rstacruz · Twitter @rstacruz