nvim-hs: Haskell plugin backend for neovim

[ apache, editor, library ] [ Propose Tags ] [ Report a vulnerability ]
This version is deprecated.

This package provides a plugin provider for neovim. It allows you to write plugins for one of the great editors of our time in the best programming language of our time! ;-)

You should find all the documentation you need inside the Neovim module. Most other modules are considered internal, so don't be annoyed if using things from there may break your code!

The following modules may also be of interest and they should not change their API: Neovim.Quickfix

If you want to write unit tests that interact with neovim, Neovim.Test provides some useful functions for that.

If you are keen to debug nvim-hs or a module you are writing, take a look at the Neovim.Debug module.

If you spot any errors or if you have great ideas, feel free to open an issue on github.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.0.1, 0.0.2, 0.0.3, 0.0.5, 0.0.6, 0.0.7, 0.0.8, 0.1.0, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 1.0.0.0, 1.0.0.1, 1.0.0.2, 1.0.0.3, 2.0.0.0, 2.1.0.0, 2.1.0.2, 2.1.0.3, 2.1.0.4, 2.1.0.5, 2.1.0.7, 2.2.0.0, 2.2.0.1, 2.2.0.2, 2.2.0.3, 2.3.0.0, 2.3.1.0, 2.3.2.0, 2.3.2.1, 2.3.2.3 (info)
Change log CHANGELOG.md
Dependencies base (>=4.9 && <5), bytestring, cereal, cereal-conduit (>=0.8.0), conduit (>=1.3.0), containers, data-default, deepseq (>=1.1 && <1.5), foreign-store, hslogger, megaparsec (<8), messagepack (>=0.5.4), mtl (>=2.2.1 && <2.3), network, optparse-applicative, path, path-io, prettyprinter (>=1.2 && <2), prettyprinter-ansi-terminal, resourcet (>=1.1.11), stm, streaming-commons, template-haskell, text, time, time-locale-compat, transformers, transformers-base, typed-process, unliftio (>=0.2), unliftio-core, utf8-string, vector, void [details]
License Apache-2.0
Copyright Copyright 2017-2018 Sebastian Witte <woozletoff@gmail.com>
Author Sebastian Witte
Maintainer woozletoff@gmail.com
Category Editor
Home page https://github.com/neovimhaskell/nvim-hs
Source repo head: git clone https://github.com/neovimhaskell/nvim-hs
Uploaded by saep at 2019-04-18T19:03:32Z
Distributions LTSHaskell:2.3.2.3, NixOS:2.3.2.3, Stackage:2.3.2.3
Reverse Dependencies 7 direct, 1 indirect [details]
Downloads 12540 total (151 in the last 30 days)
Rating 2.5 (votes: 6) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2019-04-18 [all 1 reports]

Readme for nvim-hs-2.1.0.0

[back to package description]

nvim-hs

Neovim API for Haskell plugins as well as a plugin provider. This library and executable should provide a basis for developing plugins. This package should only contain broadly useful interfaces to write plugins for neovim in haskell. The design goal is to create an easy to use API that avoids most of the boilerplate while still retaining some sense of reliability and type safety. Since Template Haskell is used to generate the neovim bindings and to avoid some of the boilerplate handy work, some exotic operating systems and architectures may not work.

Build Status Hackage version nvim-hs on latest Stackage LTS nvim-hs on Stackage Nightly

What do I have to expect if I were to use it now?

Check the issue list here on github.

How do I start using this?

You need to install a neovim plugin that manages starting of nvim-hs plugins. Just follow the instructions here: nvim-hs.vim

Once you have installed that plugin, you can use nvim-hs plugins as you would normal vim plugins. Every plugin is started as a separate process which should be fine unless you have a lot of them.

You only have to read on if you want to start "scripting" functions or plugins yourself in Haskell.

Scripting with Haskell

The entry point for all Haskell-based scripts is a plugin. An nvim-hs plugin is a plain Haskell project with two conventions:

  1. You need an executable that starts a msgpack-rpc compatible client.

  2. You need a tiny bit of vimL in your runtime path that starts the plugin.

The simplest way to get started is the stack template from this repository/package inside your neovim configuration folder which will be described here. (Alternatively, you can manually create a project and do everything that is explained in :help nvim-hs.txt which should be available if you installed the plugin mentioned in the previous section.)

You need to install stack and have the neovim executable on the path. (The API code generation calls nvim --api-info.)

Afterwards, you switch to your neovim configuration folder (typically ~/.config/nvim) and you have to create your plugin project.

cd ~/.config/nvim

stack new my-nvim-hs https://raw.githubusercontent.com/neovimhaskell/nvim-hs/master/stack-template.hsfiles --bare --omit-packages --ignore-subdirs

If you start neovim now, it will compile the example plugins which may take a few minutes. Once it is started you can use the predefined functions from the template.

:echo NextRandom()

should print a random number.

To start writing your own functions and plugins, read through the files generated by the template accompanied by the library documentation on hackage.

Contributing

Documentation, typo fixes and alike will almost always be merged.

If you want to bring forward new features or convenience libraries for interacting with neovim, you should create an issue first. The features of this (cabal) project should be kept small as this helps reducing the development time. (For some tests it is necessary to issue cabal install, so any change to to a module can significantly increase the compilation time.) If your idea solves a general problem, feel free to open an issue in the library project of nvim-hs: nvim-hs-contrib