Coder Social home page Coder Social logo

dart-nvim-api's Introduction

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.

NOTE: Dart Nvim API is still in its early stages, so there are likely to be breaking API changes.

Example Usage

import 'package:dart_nvim_api/dart_nvim_api.dart';

void main(List<String> args) async {
  // Start up Neovim instance, with optional `onNotify` and `onRequest`
  // callbacks.
  // See also Nvim.child()
  var nvim = await Nvim.spawn();

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

  // Get ex command output.

  assert(await nvim.exec('echo 1 + 1', true) == '2');

  // Buffer example:
  var buf = await nvim.createBuf(true, false);
  var bufNameWithoutPath = 'some name';
  await nvim.bufSetName(buf, bufNameWithoutPath);
  var bufName = await nvim.bufGetName(buf);
  assert(bufName.contains(bufNameWithoutPath));

  // Kill Neovim when done.
  nvim.kill();
}

dart-nvim-api's People

Contributors

simrat39 avatar smolck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dart-nvim-api's Issues

External-type-related functions don't work properly

Running the following code outputs null:

  var neovim = Neovim();
  var buf = await neovim.getCurrentBuf();
  print(buf);

I don't believe this is intended, since running this code (in Python) using pynvim outputs 1:

import pynvim

nvim = pynvim.attach('socket', path='/tmp/nvim')
test = nvim.call('nvim_get_current_buf')
print(test)

Dart (apparently) receives [1, 0, null, null] as a response from Neovim when it sends over the nvim_get_current_buf command, when it should be getting something different. It's possible that something different is being sent from Neovim and is interpreted incorrectly, but I'm not sure.

This same sort of thing happens with other Neovim commands relating to external types, like Neovim().getCurrentWin(), Neovim().listWins(), Neovim().getCurrentTabpage(), etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.