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%
Find a file
Barrett Ruth 30935f8a5f
All checks were successful
quality / Format (push) Successful in 8s
quality / Lint (push) Successful in 6s
deploy / LuaRocks (nightly) (push) Successful in 43s
docs: add quick start and rename vimdoc (#43)
## 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
2026-05-09 16:28:31 +00:00
.forgejo docs: add contributing guide (#41) 2026-05-05 17:52:44 +00:00
.github/workflows Prepare Forgejo migration (#37) 2026-05-05 15:11:02 +00:00
doc docs: add quick start and rename vimdoc (#43) 2026-05-09 16:28:31 +00:00
lua docs: add quick start and rename vimdoc (#43) 2026-05-09 16:28:31 +00:00
plugin Prepare Forgejo migration (#37) 2026-05-05 15:11:02 +00:00
scripts ci: standardize quality checks on just 2026-04-20 11:45:07 -04:00
.editorconfig feat(ci): more stuff 2026-02-03 22:05:53 -05:00
.gitignore ci: use nix 2026-02-23 18:13:09 -05:00
.luarc.json ci: scripts + format 2026-03-04 13:42:23 -05:00
.styluaignore ci: scripts + format 2026-03-04 13:42:23 -05:00
biome.json build: replace prettier with biome (#34) 2026-04-25 16:01:20 -04:00
CONTRIBUTING.md docs: add quick start and rename vimdoc (#43) 2026-05-09 16:28:31 +00:00
flake.lock build(nix): use nixpkgs vimdoc-language-server (#33) 2026-04-20 17:35:34 -04:00
flake.nix build: replace prettier with biome (#34) 2026-04-25 16:01:20 -04:00
import-cost.nvim-scm-1.rockspec Prepare Forgejo migration (#37) 2026-05-05 15:11:02 +00:00
index.js fix detecting lang 2023-01-12 09:56:53 +09:00
justfile Prepare Forgejo migration (#37) 2026-05-05 15:11:02 +00:00
LICENSE chore: switch LICENSE to GPLv3 (post-remigrate) 2026-05-01 11:57:26 +00:00
README.md docs: add quick start and rename vimdoc (#43) 2026-05-09 16:28:31 +00:00
selene.toml ci: use nix 2026-02-23 18:13:09 -05:00
stylua.toml fix(ci): better configs 2026-02-03 22:04:02 -05:00
vim.yaml ci: scripts + format 2026-03-04 13:42:23 -05:00

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-migration to optionally update your plugin source configuration.

preview

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

  1. CommonJS support is flaky (limitation of the npm module)
  2. Long wait times for large packages
  3. pnpm is not supported

Acknowledgements