bary12 / vim-import-cost

πŸ‹οΈβ€β™‚οΈ Display the import size of the JavaScript packages in Vim!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vim-import-cost

Build Status

This plugin is a (very rough) port of the import-cost plugin for Visual Studio Code. In a nutshell, it calculates the bundle size for each import or require statement. However, unlike the original plugin, this plugins does not show the calculated size as inline text. Instead, it exposes commands that allows you to calculate the package's size on demand.

This plugin uses the import-cost module (also part of the origin import-cost plugin) that uses webpack to calculate the size of the imported module.

You can find more information about how the size calculation process works in this blog post.

Note: this plugin is still a work-in-progress!

Installation

Use you favorite plugin manager to install this plugin. Make sure to have node (>= 8) and npm installed.

Using vim-plug:

Plug 'yardnsm/vim-import-cost', { 'do': 'npm install' }

If you're installing the plugin in different way, make sure to run npm install in the root path of the plugin directory, so the required dependencies will be installed.

Usage

Use the :ImportCost command when inside a JavaScript / TypeScript buffer. This commands also support ranges, so you can initiate it from VISUAL mode.

Use the :ImportCostSingle command if you wish to process the current line only.

Configuration

Find the available configuration methods in the plugin's help file.

:help import_cost

License

MIT Β© Yarden Sod-Moriah

About

πŸ‹οΈβ€β™‚οΈ Display the import size of the JavaScript packages in Vim!

License:MIT License


Languages

Language:Vim Script 90.6%Language:JavaScript 9.4%