Presenting Haxe-Neovim

Some weeks ago I asked if anyone was using Haxe to build Neovim plugins, and nobody seem to be doing that, so I opted to build it from scratch.
Below is the presentation I made on Discord, but I think it also belongs here:

NeoVim is great, and Lua is also great, but when you want to create complex NeoVim configurations in Lua, things are not so great.
Lot of guess-work and trial and error, stupid mistakes that translate to hard to understand runtime errors which could make your editor unusable, something nobody wants.
Haxe on the other hand, has a great type system, capable to express very complex systems with complex requirements and prevent you from doing those little silly mistakes.
Would’t be cool if we could use the power of Haxe to write more reliable NeoVim configurations and Plugins? Turns out that with some effort it is possible, and that has been my objective for the past weeks, and I finally decided to release the project.

Presenting Haxe NeoVim. A collection of automatically generated NeoVim extern definitions, coupled with hand-crafted ones and some handy utility helpers on top.
I’m currently dogfooding it for my personal configurations and personal NeoVim projects, so the real coding is happening in my personal dotfiles repository where the whole library lives. However, I want this to be used by more people if they have the need, so I setup a mirror repository where only Haxe NeoVim specific code is pushed automatically.

Here is the separate project repository:

The library code is inside src/ , and if you are looking for examples, inside the kickstart folder you can find some advanced usage examples. That folder is a port of kickstart.nvim to Haxe using this library definitions.


Well I haven’t ever wrote a neovim plugin ever but actually I use haxe with neovim

this is my repo I actually had to copy files from haxe-tree-sitter into it’s config files for syntax highlighting rather than that Haxe LSP works there.

By the way good work on haxe lua externs for nvim :ok_hand:

Thank you. Hope someone starts using them too!

1 Like

Some project progress report.
Now the entire list of options under vim.opt and vim.wopt has been mapped to haxe.
This means that you can configure most of the more importants neovim options from haxe code. For example, some of the more important to me are:

  Vim.o.hlsearch = false;
  Vim.o.mouse = 'a';
  Vim.o.breakindent = true;
  Vim.o.undofile = true;
  Vim.wo.Number = true;

Each option is fully documented in comments, so in case you want to know what it does all you need to the definition point. I’m working in making this be part of the intellisense popup tough.

If you want to read a couple of thousand lines of haxe code, here is the specific commit: feat: Full vim.opt options mapped · danielo515/dotfiles@da7bc75 · GitHub


I want to anounce what I think it is a big milestone for the project:

:tada: :tada: haxe-neovim was published to haxelib :tada: :tada:

Had to polish some aspects of it, and make sure it works when you install it, but I’m very proud I made it.

Of course, because we humans learn better by examples I also wrote an example NeoVim plugin so anyone can use it as inspiration or as a template for their own Haxe-NeoVim plugins: GitHub - danielo515/haxe-nvim-example-plugin

I hope this encourages people to start using it either for new plugins or to just write their personal configurations for NeoVim in Haxe.