Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nib-plugin-example

An example plugin for nib, written in Go with its Go SDK. It shows how many words the shown buffer has in the status line, and answers the wordcount.count command with the number.

Install

nib plugin add nib-editor/plugin-example

It needs no capabilities. It loads the next time nib starts.

Build

You need TinyGo 0.42 or later (with Go 1.25 to 1.27), binaryen's wasm-opt, and wasm-tools.

tinygo build -target=wasip2 \
  --wit-package "$(go list -m -f '{{.Dir}}' github.com/nib-editor/nib/sdk/go)/wit" \
  --wit-world plugin -o plugin.wasm .

With nib 0.9 or later, nib plugin build runs the same command.

Test

nib plugin test

runs the tests in tests/ in an editor without a terminal. Try the build without installing it with nib --plugin ..

Release

Set version in plugin.toml, then push a tag of the same version:

git tag v0.1.0 && git push origin v0.1.0

The release workflow builds the plugin and publishes wordcount-0.1.0.nib.tar.gz, which nib plugin add and nib plugin update look for.

License

MIT

About

An example nib plugin in Go: a word count in the status line

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages