npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

jsvi

v0.3.0

Published

VI Editor implemented in JavaScript for use in Browser

Readme

npm version JSDelivr CDN download CI Coverage Status

Zero dependency, VI editor implemented in JavaScript, which turns any <textarea> into a full-screen VI-style editor running in the browser. It's a maintained fork of a project created by Internet Connection, Inc..

Screenshot

jsVI screenshot

Install

npm install jsvi

Usage

ES Module

import vi from 'jsvi';
import 'jsvi/vi.css';

const textarea = document.querySelector('#editor');
const editor = vi(textarea, {
    color: '#ccc',
    backgroundColor: '#000',
    onSave() {
        console.log('contents:', textarea.value);
        console.log('contents:', editor.freeze());
    },
    onExit() {
        console.log('editor closed');
    }
});

TypeScript types for the public API (the vi() factory and the editor instance it returns) are included, so import vi from 'jsvi' is typed out of the box.

Script Tag (jsDelivr)

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jsvi/vi.css" />
<script src="https://cdn.jsdelivr.net/npm/jsvi/vi.js"></script>
<script>
    const editor = vi(document.querySelector('#editor'));
</script>

This build exposes a global vi function, same as before — no bundler required.

API

vi(textarea, options?) replaces the given <textarea> with the editor UI and returns an editor instance. Options:

| Option | Type | Description | |-------------------|----------------------------|-------------------------------------------| | onSave | () => void | Called when file is saved (:w) | | onExit | () => void | Called when the editor is closed (:q) | | color | string | Foreground color (needs backgroundColor) | | backgroundColor | string | Background color (needs color) | | spell_script | string | URL of a server-side spell-check script | | padding | number | Space in pixels around the editor's text area (default 0) | | html | boolean | Interpret <b>/<u>/<i>/<span class="rv"> and &amp;/&lt; as rich-text markup, and escape </& on save (default false, plain text) |

The returned editor instance exposes methods such as freeze() / thaw() (serialize/load the buffer), insert(), delete(), command() (run an ex command), and disable() (tear down the editor). See vi.esm.d.ts for the full public interface.

color/backgroundColor are applied inline on the editor, so they override the --color/--background CSS custom properties described below. To theme the editor from CSS instead (e.g. to share a theme with jQuery Terminal, which uses the same variable names), set --color/--background on an ancestor and omit color/backgroundColor from the options.

Cursor style

The cursor blinks using a CSS animation, the same mechanism as jQuery Terminal (with vi--prefixed names so the two don't collide if used on the same page). Pick a style by setting the --vi-animation custom property:

:root {
    --vi-animation: vi-blink;     /* solid block cursor (default) */
    --vi-animation: vi-underline; /* thin line under the character */
    --vi-animation: vi-bar;       /* thin vertical bar, like a text caret */
    --vi-animation: vi-none;      /* static cursor, no blinking */
}

vi-bar/vi-underline use --vi-line-thickness (default 2, in pixels) for the line's thickness. When the OS-level "reduce motion" accessibility preference is set, --vi-animation defaults to vi-none (a static, non-blinking cursor) unless overridden by a later, equally-specific :root rule.

Development

npm install
npm run build      # generates vi.esm.js from vi.js
npm run typecheck  # type-checks the public interface with tsc
npm test           # runs the Vitest + jsdom test suite
npm run coverage   # runs tests with a code coverage report

vi.js is the original ES5 source and is also the browser/script-tag build; vi.esm.js is generated from it (with an export default added) so the package can be imported by name.

License