Set up your editor for Unison

This document is a collection of user-submitted instructions for setting up a text editor for Unison development.

LSP Integration

As of UCM version M4a, the UCM supports the Language Server Protocol. Features like in-editor error reporting, show-type-on-hover, and autocompletion are implemented, with more to come! Instructions for installing the UCM with LSP support are available here

Vim

Using vim-plug:

  1. Install vim-plug if you haven't already.
  2. Add the following to your .vimrc:
Plug 'unisonweb/unison', { 'branch': 'trunk', 'rtp': 'editor-support/vim' }
  1. Issue the vim command :PlugInstall.

For more information run :help unison from within vim or view the online help doc.

NeoVim

Using lazy.nvim:

  1. Install lazy.nvim if you haven't already.
  2. Add the following to your init.lua:
require("lazy").setup({
  {
    -- Unison
    "unisonweb/unison",
    branch = "trunk",
    config = function(plugin)
        vim.opt.rtp:append(plugin.dir .. "/editor-support/vim")
        require("lazy.core.loader").packadd(plugin.dir .. "/editor-support/vim")
    end,
    init = function(plugin)
         require("lazy.core.loader").ftdetect(plugin.dir .. "/editor-support/vim")
    end,
  }
})
  1. Issue the vim command :Lazy.

Optionally you can setup an LSP Server.

Atom

From the console, run:

apm install unisonweb/atom-unison

VS Code

  1. Install the Unison extension for VS Code

Emacs

There are currently two different ways to use Unison in Emacs. Both work with Unisonā€™s LSP integration.

Unison Tree-sitter mode

This package is generally better all around, but isnā€™t in MELPA yet, and thus requires more setup.

If you donā€™t have Emacs 29 or newer, this also requires installing tree-sitter.

unisonlang-mode

This package is unsupported, incomplete, and out of date, but it is in MELPA, so you can enable it how you would any other Emacs package, and youā€™re done.