🏋️‍♂️ Display the import size of the JavaScript packages in Vim!

License: MIT

Language: Vim script

Keywords: import-cost, javascript, performance, vim, webpack


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.


Use your favorite plugin manager to install this plugin. Make sure to have node (>= 8) and npm both installed and available in your $PATH.

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.


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.


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

:help import_cost


MIT © Yarden Sod-Moriah

Project Statistics

Sourcerank 4
Repository Size 383 KB
Stars 51
Forks 3
Watchers 2
Open issues 5
Dependencies 5
Contributors 4
Tags 1
Last updated
Last pushed

Top Contributors See all

Yarden Sod-Moriah Matt Greer Bary Levi Wang Shidong

Recent Tags See all

v1.0 October 27, 2018

Something wrong with this page? Make a suggestion

Last synced: 2018-11-17 09:26:37 UTC

Login to resync this repository