{"id":13485318,"url":"https://github.com/yardnsm/vim-import-cost","last_synced_at":"2026-01-16T19:47:49.593Z","repository":{"id":33382159,"uuid":"144605182","full_name":"yardnsm/vim-import-cost","owner":"yardnsm","description":"🏋️‍♂️ Display the import size of the JavaScript packages in Vim!","archived":false,"fork":false,"pushed_at":"2021-11-02T16:36:55.000Z","size":1347,"stargazers_count":150,"open_issues_count":1,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-30T19:42:58.301Z","etag":null,"topics":["import-cost","javascript","performance","vim","webpack"],"latest_commit_sha":null,"homepage":"","language":"Vim script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yardnsm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-13T16:22:57.000Z","updated_at":"2024-08-19T13:40:54.000Z","dependencies_parsed_at":"2022-07-31T10:48:08.656Z","dependency_job_id":null,"html_url":"https://github.com/yardnsm/vim-import-cost","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yardnsm%2Fvim-import-cost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yardnsm%2Fvim-import-cost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yardnsm%2Fvim-import-cost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yardnsm%2Fvim-import-cost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yardnsm","download_url":"https://codeload.github.com/yardnsm/vim-import-cost/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245892512,"owners_count":20689510,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["import-cost","javascript","performance","vim","webpack"],"created_at":"2024-07-31T17:01:55.136Z","updated_at":"2026-01-16T19:47:49.552Z","avatar_url":"https://github.com/yardnsm.png","language":"Vim script","readme":"# vim-import-cost\n\n[![Build Status](https://travis-ci.org/yardnsm/vim-import-cost.svg?branch=master)](https://travis-ci.org/yardnsm/vim-import-cost)\n\n![](.github/assets/demo.gif)\n\nThis plugin is a (very rough) port of the [import-cost](https://github.com/wix/import-cost) plugin\nfor Visual Studio Code. In a nutshell, it calculates the bundle size for each `import` statement or\n`require` calls. Thanks to Neovim's virtual text feature, this plugin can show the calculated size\nnext to the `import` statements, with a fallback to showing the calculated size in a\nscratch buffer.\n\nThis plugin exposes commands that allows you to calculate the package's size on demand. By default\nit'll try to use Neovim's virtual text feature.\n\nThis plugin uses the\n[`import-cost`](https://github.com/wix/import-cost/tree/master/packages/import-cost) module (also\npart of the original import-cost plugin) that uses `webpack` to calculate the size of the imported\nmodule.\n\nYou can find more information about how the size calculation process works in [this blog\npost](https://hackernoon.com/keep-your-bundle-size-under-control-with-import-cost-vscode-extension-5d476b3c5a76).\n\n## Installation\n\nUse your favorite plugin manager to install this plugin. Make sure to have `node` (\u003e= 8) and `npm`\nboth installed and available in your `$PATH`.\n\n### Using [vim-plug](https://github.com/junegunn/vim-plug):\n\n```vim\nPlug 'yardnsm/vim-import-cost', { 'do': 'npm install --production' }\n```\n\nIf you're installing the plugin in different way, make sure to run `npm install` in the root path of\nthe plugin directory, so the required dependencies will be installed.\n\n## Usage\n\nYou can initiate the plugin by demand; it does not offer any automatic calculation out of the box.\n\n- Use the `:ImportCost` command when inside a JavaScript / TypeScript buffer. This commands also\n  support ranges, so you can initiate it from VISUAL mode.\n- Use the `:ImportCostSingle` command if you wish to process the current line only.\n- Use the `:ImportCostClear` command to clear the virtual text set by the plugin.\n\n## Configuration\n\nFind the available configuration methods in the plugin's [help file](./doc/import_cost.txt).\n\n```vim\n:help import_cost\n```\n\n## FAQ\n\n### How can I automatically run this plugin on buffer updates?\n\nYou can all the `:ImportCost` command within an `autocmd`, so it can be triggered when the buffer is\nupdated. **This is not recommended to use when the virtual text feature is not supported.**\n\n```vim\n\" Put this in your .vimrc\naugroup import_cost_auto_run\n  autocmd!\n  autocmd InsertLeave *.js,*.jsx,*.ts,*.tsx ImportCost\n  autocmd BufEnter *.js,*.jsx,*.ts,*.tsx ImportCost\n  autocmd CursorHold *.js,*.jsx,*.ts,*.tsx ImportCost\naugroup END\n```\n\n---\n\n## License\n\nMIT © [Yarden Sod-Moriah](http://yardnsm.net/)\n","funding_links":[],"categories":["Vim Script","Vim script"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyardnsm%2Fvim-import-cost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyardnsm%2Fvim-import-cost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyardnsm%2Fvim-import-cost/lists"}