dart_nvim_api 0.1.4 copy "dart_nvim_api: ^0.1.4" to clipboard
dart_nvim_api: ^0.1.4 copied to clipboard

outdated

A Neovim API for Dart allowing for communication between a Neovim instance and a Dart program. Can be used for creating Neovim plugins, Neovim frontend GUIs, etc.

Build Status Pub

Dart Nvim API #

Neovim API implementation for Dart, based on and inspired by neovim-lib. Still a WIP, so any feedback, contributions, etc. are greatly appreciated.

Example Usage #

import 'package:dart_nvim_api/dart_nvim_api.dart';

main(List<String> args) async {
  // Start up Neovim instance and communicate over stdin/stdout:
  var nvim = Neovim(nvimBinaryPath: 'nvim');

  // Or connect to already running instance over TCP:
  // var nvim = Neovim.connectToRunningInstance(host: '127.0.0.1', port: 8888);

  // Run Neovim ex command.
  await nvim.command("echo 'hello'");

  // Get ex command output.
  assert(await nvim.commandOutput("echo 'hello'") == null);

  // Buffer example:
  var buf = await nvim.createBuf(true, false);
  var bufNum = await buf.getNumber(nvim);
  assert(bufNum == 2);
  assert(await nvim.getCurrentBuf() is Buffer);

  // Beyond that, you can run any Neovim api command. See `:help api-rpc` doc in Neovim.
  // See also `example` directory.
}

Contributing #

Changes to the Neovim, Window, Buffer, and Tabpage classes should be done in the template files in the gen_bindings/src folder. To generate lib/src/*.dart do the following from the project root (requires pip in addition to python v3.7.4. Note that older versions of Python 3 may work, I just haven't tested them):

$ pip install -g datetime jinja2
# Replacing <nvim binary path> as necessary:
$ python gen_bindings/gen_bindings.py <nvim binary path> 'lib/src' 'gen_bindings/src/'

Changes to any other files can be done as usual.

3
likes
0
pub points
1%
popularity

Publisher

unverified uploader

A Neovim API for Dart allowing for communication between a Neovim instance and a Dart program. Can be used for creating Neovim plugins, Neovim frontend GUIs, etc.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

meta, msgpack_dart

More

Packages that depend on dart_nvim_api