nvimhost 1.1.0

Nvim (neovim) host provider and API client library.

To use this package, put the following dependency into your project's dependencies section:


pipeline status DUB Package


Neovim (nvim) host plugin provider and API client library in D.



The following snippets show how you can use this library, check out the examples for more information. This GIF shows the demo-plugin below in action:


Plugin snippet demo

import nvimhost.plugin;
import nvimhost.api;

struct DemoPlugin {

    NvimAPI nvim;

    this(ref NvimAPI nvim) {
        this.nvim = nvim;

    // sync function with one argument
    string greet(string name) {
        return "Hello " ~ name;

    // sync function with multiple arguments
    int sumBeginToEnd(int begin, int end) {
        import std.range;
        import std.algorithm.iteration;
        import std.stdio;

        return cast(int) iota(begin, end).sum();

    // sync function calling async (non blocking) nvim functions
    int setVarValue(int i) {
        import std.conv;

        nvim.commandAsync("let g:test_var_value=" ~ i.to!string);
        return i;

    // async function calling both async and sync nvim functions
    @NvimFunc("SetVarValueAsync", Async)
    void setVarValueAsync(int i) {
        import std.conv;

        nvim.commandAsync("let g:testasync_var_value=" ~ i.to!string);
        nvim.command("echomsg 'hello world sync!'");


void main() {

    // make sure you source this .vim file in neovim, since this will bootstrap
    // the binary and register the plugin
    auto pluginDstFile = "~/.config/nvim/settings/demo-plugin.vim";
    // template instantiate DemoPlugin
    auto plugin = NvimPlugin!(DemoPlugin)("demo-plugin", pluginDstFile);
    // keep it running
    scope (exit) {

API client snippet demo

void main() {
    import std.stdio;
    import nvimhost.api : NvimAPI;
    auto nvim = NvimAPI();

    // Calling a simple command on Neovim
    nvim.command("echomsg 'hello world!'");

    // Iterating over loaded buffers
    auto buffers = nvim.vimGetBuffers();
    foreach (buffer; buffers) {
        writeln("buffer #", buffer);

You can find the code documentation generated by the dub registry here.

How to install and build

  • Fetch it using dub, and use it as a library in your source code by importing the nvimhost package:

dub fetch nvimhost
dub build --build=release

For more information about building binaries, check out the .gitlab-ci.yml file


Both unit tests and system tests (end-to-end) testing with nvim have been automated in the CI.

  • @viniarck
  • viniarck@gmail.com
  • Vinicius S. Arcanjo
msgpack-d, vibe-core
1.1.1 2019-Jan-08
1.1.0 2019-Jan-06
1.0.0 2018-Dec-31
~master 2019-Jan-08
Show all 4 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 2 downloads total

Short URL: