display javascript import costs inside of neovim
https://git.barrettruth.com/barrettruth/import-cost.nvim
- Lua 75.3%
- Shell 9.7%
- JavaScript 5.8%
- Nix 5.2%
- PowerShell 2.2%
- Other 1.8%
## Checklist - [x] I have read [CONTRIBUTING.md](https://git.barrettruth.com/barrettruth/import-cost.nvim/src/branch/main/CONTRIBUTING.md). - [ ] No AI was used to generate, edit, or review any part of this contribution. ## Problem The README and migration warning still pointed users at legacy `.nvim` help topics, and the vimdoc file used the legacy filename. ## Solution - Rename the vimdoc file to `doc/import-cost.txt` while preserving legacy help tags. - Keep Installation separate from Quick Start, with both `vim.pack` and LuaRocks install paths intact. - Add a concise Quick Start for post-install use: supported buffers attach automatically and `vim.g.import_cost` customizes behavior. - Update README, CONTRIBUTING, and the migration warning to prefer the clean help topics. ## Verification - `git diff --check` - `vimdoc-language-server check doc/` - `vimdoc-language-server format --check doc/` - `stylua --check lua/import-cost/migration.lua` - `just lint` Reviewed-on: https://git.barrettruth.com/barrettruth/import-cost.nvim/pulls/43 |
||
|---|---|---|
| .forgejo | ||
| .github/workflows | ||
| doc | ||
| lua | ||
| plugin | ||
| scripts | ||
| .editorconfig | ||
| .gitignore | ||
| .luarc.json | ||
| .styluaignore | ||
| biome.json | ||
| CONTRIBUTING.md | ||
| flake.lock | ||
| flake.nix | ||
| import-cost.nvim-scm-1.rockspec | ||
| index.js | ||
| justfile | ||
| LICENSE | ||
| README.md | ||
| selene.toml | ||
| stylua.toml | ||
| vim.yaml | ||
import-cost.nvim
Display javascript import costs inside neovim, powered by import-cost.
Note
Due to GitHub's historic unreliability, active development is hosted on Forgejo. GitHub is maintained as a read-only mirror. See
:help import-cost-migrationto optionally update your plugin source configuration.
Installation
With vim.pack (Neovim 0.12+):
vim.pack.add({
'https://git.barrettruth.com/barrettruth/import-cost.nvim',
})
Or via luarocks:
luarocks install import-cost.nvim
Dependencies are installed automatically on first use.
Quick Start
Open a JavaScript, TypeScript, or Svelte file with import statements and wait for inline virtual text costs to appear.
If the defaults need changing, set vim.g.import_cost before the plugin
loads.
vim.g.import_cost = {
package_manager = 'yarn',
format = {
virtual_text = '%s',
},
highlight = 'Comment',
}
Documentation
:help import-cost
Known Issues
- CommonJS support is flaky (limitation of the npm module)
- Long wait times for large packages
- pnpm is not supported
Acknowledgements
- wix/import-cost: node backend
- import-cost: original VSCode plugin
- vim-import-cost: vim inspiration
