• Stars
    star
    218
  • Rank 181,805 (Top 4 %)
  • Language
    Vim Script
  • Created over 8 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A neovim plugin for Intero, forked from ghcmod-vim

Sunset Notice

The intero project has reached sunset status and will no longer be supported. As such, this plugin will also be in sunset mode.

The GHCi mode is still useful from this plugin. I would suggest someone forking this repository, removing intero specific code, and releasing it as a new plugin.

Intero for Neovim

Build Status

A complete interactive development program for Haskell

Intero makes working with Haskell painless by harnessing the power of the GHCi REPL. Intero was originally built alongside an Emacs package. This plugin ports much of the Emacs plugin functionality into a package for Neovim.

Intero for Neovim asciicast


Some key features:

  • Designed for Stack

    Intero requires Stack. If your project works with Stack, it almost definitely works with Intero.

  • Automatic Setup

    intero-neovim takes care of installing Intero into your Stack environment. The installation is local (not global!). This means that Intero is always current for each of your projects. The goal of Intero is to Just Workβ„’.

  • Bring Your Own GHCi

    You can configure the plugin to use a custom backend, e.g. cabal repl or plain ghci, instead of the default Intero backend. Newer features are enabled based on the GHCi version.

  • On-the-fly Typechecking

    Intero reports errors and warnings as you work on your file using the Neomake plugin. Errors appear asynchronously, and don't block the UI.

  • Built-in REPL

    Work with your Haskell code directly in GHCi using Neovim :terminal buffers. Load your file and play around with top-level functions directly.

  • Type Information

    You can ask for type information of the identifier under your cursor as well as of a selection. Intero makes an effort to remember type information even when the module no longer typechecks.

  • Jump to Definition

    After a module has been loaded by Intero, you can jump to the defintion of any identifiers within your package. If the identifier comes from a different package, Intero will tell you which package the identifier comes from.

  • Easy Target Switching

    Intero makes working with multiple stack targets simple. Jump between your app and test suite seamlessly.

Installing

This plugin is compatible with pathogen, vim-plug, etc. For example:

Plug 'parsonsmatt/intero-neovim'

This plugin requires Stack. Optionally, install Neomake for error reporting.

Quickstart

The goal of Intero is to Just Workβ„’. Most of the hard work is done behind the scenes. Intero will set itself up automatically when you open a Haskell file.

  • To open the REPL:
    • :InteroOpen
  • To load into the REPL:
    • :InteroLoadCurrentFile
  • To reload whatever's in the REPL:
    • :InteroReload
  • To get the type of the current identifier or selection:
    • in your vimrc: map <silent> <leader>t <Plug>InteroGenericType
    • then: press <leader>t
  • To jump to a definition:
    • first :InteroLoadCurrentFile
    • then :InteroGoToDef.
  • To switch targets:
    • :InteroSetTargets

Usage

Complete usage and configuration information can be found in here:

:help intero

Example Configuration

These are some suggested settings. This plugin sets up no keybindings by default.

augroup interoMaps
  au!
  " Maps for intero. Restrict to Haskell buffers so the bindings don't collide.

  " Background process and window management
  au FileType haskell nnoremap <silent> <leader>is :InteroStart<CR>
  au FileType haskell nnoremap <silent> <leader>ik :InteroKill<CR>

  " Open intero/GHCi split horizontally
  au FileType haskell nnoremap <silent> <leader>io :InteroOpen<CR>
  " Open intero/GHCi split vertically
  au FileType haskell nnoremap <silent> <leader>iov :InteroOpen<CR><C-W>H
  au FileType haskell nnoremap <silent> <leader>ih :InteroHide<CR>

  " Reloading (pick one)
  " Automatically reload on save
  au BufWritePost *.hs InteroReload
  " Manually save and reload
  au FileType haskell nnoremap <silent> <leader>wr :w \| :InteroReload<CR>

  " Load individual modules
  au FileType haskell nnoremap <silent> <leader>il :InteroLoadCurrentModule<CR>
  au FileType haskell nnoremap <silent> <leader>if :InteroLoadCurrentFile<CR>

  " Type-related information
  " Heads up! These next two differ from the rest.
  au FileType haskell map <silent> <leader>t <Plug>InteroGenericType
  au FileType haskell map <silent> <leader>T <Plug>InteroType
  au FileType haskell nnoremap <silent> <leader>it :InteroTypeInsert<CR>

  " Navigation
  au FileType haskell nnoremap <silent> <leader>jd :InteroGoToDef<CR>

  " Managing targets
  " Prompts you to enter targets (no silent):
  au FileType haskell nnoremap <leader>ist :InteroSetTargets<SPACE>
augroup END

" Intero starts automatically. Set this if you'd like to prevent that.
let g:intero_start_immediately = 0

" Enable type information on hover (when holding cursor at point for ~1 second).
let g:intero_type_on_hover = 1

" Change the intero window size; default is 10.
let g:intero_window_size = 15

" Sets the intero window to split vertically; default is horizontal
let g:intero_vertical_split = 1

" OPTIONAL: Make the update time shorter, so the type info will trigger faster.
set updatetime=1000

Using a Custom Backend

The default Intero backend can be overriden, so that you can use this plugin without Stack and Intero. The following configuration uses cabal new-repl, and specifies a cwd for a sub-directory project:

let g:intero_backend = {
        \ 'command': 'cabal new-repl',
        \ 'options': '-Wall',
        \ 'cwd': expand('%:p:h'),
        \}

Such configuration can be set per-project using a local .nvimrc file, or in your init file for a system-wide effect.

NOTE: If g:intero_backend is set, g:intero_ghci_options and g:intero_load_targets have no effect.

Caveats

  • Running :Neomake! directly will not work. You need to run :InteroReload instead.

  • Some commands may have unexpected side-effects if you have an autocommand that automatically switches to insert mode when entering a terminal buffer.

  • Completion is not handled by this plugin. You might want to checkout out neco-ghc if you want completion.

License

BSD3 License, the same license as ghcmod-vim.

More Repositories

1

servant-persistent

A brief example of Servant with Persistent
Haskell
293
star
2

parsonsmatt.github.io

My Github pages website
SCSS
68
star
3

purs-architecture-tutorial

A port of the Elm Architecture Tutorial to PureScript
PureScript
55
star
4

rowdy

A convenient DSL for describing web routes
Haskell
43
star
5

hasktuts

A collection of introductory tutorials on Haskell libraries
43
star
6

QuickLift

Web application to quickly and easily log your weightlifting sessions
Haskell
38
star
7

garlic-bread

Leave delicious breadcrumbs to make your errors easier to understand.
Haskell
37
star
8

kale

A quick, easy, and declarative task runner for Haskell code to destroy your boiler plate!
Haskell
33
star
9

monad-metrics

haskell metrics
Haskell
31
star
10

annotated-exception

Machinery for throwing and catching exceptions with some annotation.
Haskell
28
star
11

persistent-typed-db

A type and helpers for typesafe SQL access in the presence of many databases.
Haskell
23
star
12

encoding-via

type classes and deriving via for encoding
Haskell
22
star
13

hotel-california

A tool for OpenTelemetry tracing on the command line
Haskell
21
star
14

purescript-routing-example

An example of purescript-routing and purescript-halogen
PureScript
20
star
15

plucky

Plucky errors and exceptions
Haskell
20
star
16

require-callstack

Require that callers propagate `HasCallStack` constraints
Haskell
19
star
17

prairie

First Class Record Fields in Haskell
Haskell
17
star
18

persistent-pagination

Efficient and correct pagination!
Haskell
16
star
19

ql-purs

QuickLift frontend in PureScript
PureScript
15
star
20

hedgehog-fakedata

A compatibility library for `hedgehog` and `fakedata`
Haskell
15
star
21

prio

Plucky Runtime IO
Haskell
15
star
22

beginner-error-messages

Informative error messages for common beginner misunderstandings with Haskell
Haskell
15
star
23

persistent-documentation

DSL for attaching documentation to persistent entities
Haskell
14
star
24

smoltok

An implementation of Smalltalk 80 in Rust
Rust
13
star
25

ghc-compile-stats

stupid lil program to parse GHC/cabal output and tell you how long stuff takes
Haskell
10
star
26

record-wrangler

Alter datatypes at your leisure!
Haskell
8
star
27

modalities

Repository for my independent study at UGA
TeX
8
star
28

gear-tracker

An application that helps cyclists track their gear
Haskell
8
star
29

monad-logger-prefix

Easily add a prefix to your MonadLogger output.
HTML
7
star
30

data-diff

An approach to diffing values and records.
Haskell
7
star
31

ghc-cache-buster

Haskell
7
star
32

pureflowy

A workflow management tool written in Haskell and PureScript
PureScript
7
star
33

beethoven

A gem for class composition in Ruby
Ruby
6
star
34

unification

implementation of the first order logic unification algorithm in Haskell
Haskell
6
star
35

purescript-trees

Rose trees
PureScript
6
star
36

scotty-persistent-example

Repository to go along with a blog post
Haskell
6
star
37

packedbits

are you worried about space? ME TOO! SPACE IS VERY CONCERNING
Haskell
6
star
38

lift-type

Lift a type into a Template Hasell Type.
Haskell
6
star
39

callstacks-what-even

callstacks in ghc are weird
Haskell
6
star
40

exceptiot

A type `ExceptIOT` which uses `IO` for the `MonadError` instance, allowing a `MonadUnliftIO` instance
Haskell
5
star
41

exception-via

Derive hierarchical exception instances for your datatypes
Haskell
5
star
42

performance-debugging

An adventure in debugging the performance of a Haskell data structure
Haskell
5
star
43

big-government

When you want to give the State more responsibility and power
Haskell
5
star
44

command-pattern

JavaScript
5
star
45

hash-rekt

An extensible record library based on HashMaps.
Haskell
5
star
46

record-impl

Haskell
5
star
47

incremental-servant

Replace your old API with a Servant one!
Haskell
5
star
48

oncet

A library for defining lazy recipes with components that are only run once
Haskell
5
star
49

callstack-examples

Haskell
5
star
50

glob-imports

A utility for package metaprogramming imports
Haskell
5
star
51

liboath-hs

Haskell bindings to the liboath library.
Haskell
4
star
52

yo-dawg

Haskell API in Haskell website
Haskell
4
star
53

sincify

Generate `since` annotations for a package.
Makefile
4
star
54

persistent-discover

Discover your Persistent Models with Ease
Haskell
4
star
55

split-persistent

An example on splitting up a persistent models file (see PRs)
Haskell
4
star
56

mesa-verde

Scrap your Persistent quasiquoter!
Haskell
4
star
57

abstract-fork

A type class for forking threads
Haskell
4
star
58

coerce-role

Derive fearlessly in the face of roles
Haskell
4
star
59

HASKELL_TEMPLATE

a template repository for my haskell projects
Makefile
3
star
60

rails-box

Barebones box for Rails development.
Shell
3
star
61

discover-instances

A TemplateHaskell helper that discovers type class instances for you
Haskell
3
star
62

dpll

An implementation of the DPLL algorithm in Haskell, using an 'exploratory coding' methodology.
Haskell
3
star
63

cis194

Homework for the Haskell course: http://www.seas.upenn.edu/~cis194/spring13/lectures.html
Haskell
3
star
64

wyas

Write Yourself a Scheme!
Haskell
3
star
65

WifiWizardDemo

Demo phonegap application for WifiWIzard
Java
3
star
66

some-dict-of

A Haskell library for packaging and using constraints, existentially.
Haskell
3
star
67

exceptional-haskell

A talk on exceptions and errors in Haskell.
JavaScript
3
star
68

websockets-example

A test app of websockets
PureScript
3
star
69

purescript-pux-undo

Convenient undo/redo functionality for your Pux application
PureScript
3
star
70

metricord

A web application for recording metrics and doing aggregations
Haskell
3
star
71

esqueleto-compat

Compatibility operators and exports to make importing Esqueleto and Persistent easier
Haskell
3
star
72

defer-diagnostics-reproduction

This repo gives a reproduction for defer diagnostics on GHC 9.4.2
Makefile
2
star
73

currb

Presentation on currying and function composition in Ruby
JavaScript
2
star
74

gamma

maybe this is a programming language?
Haskell
2
star
75

abstract-effects

A package for abstract effects in Haskell
2
star
76

servant-ruby

Generate Ruby clients from your Servant API!
Haskell
2
star
77

spellcards

a silly little Haskell app to print out some cards for D&D spells
Haskell
2
star
78

hspec-yesod

Forked from `yesod-test` to support idiomatic `hspec` testing
Haskell
2
star
79

distributed

Playing with Cloud Haskell
Haskell
2
star
80

write-buffer

If single writes are slowing you down, who you gonna call? WRITE BUFFER!
Haskell
2
star
81

design-patterns-math

Design Patterns from Abstract Math
JavaScript
2
star
82

haskell-parser

A parser for Haskell implemented in Rust.
Rust
1
star
83

multicast

Toy implementation of a multicast chat server
Haskell
1
star
84

disc-inst-bug

reproduction for a GHC bug #20563
Haskell
1
star
85

hlift

Haskell weightlifting utility
Haskell
1
star
86

pux-repro

reproduction of issue purescript-pux#14
PureScript
1
star
87

require-callstack-talk

Haskell
1
star
88

slowlift

yet another weightlifitng app
Haskell
1
star
89

squirrell

kinda magical query objects
Ruby
1
star
90

purescript-zippers

Zippers for PureScript
PureScript
1
star
91

routerhs

playing with nesting RESTful routes in Haskell
Haskell
1
star
92

logic

Haskell
1
star
93

gol

implementation of Game of Life in Haskell
Haskell
1
star
94

tiger

Working through the Appel book in Haskell
Haskell
1
star
95

cardano-wallet

fork of cardano-wallet from when i worked at iohk
Haskell
1
star
96

OkFilter

OkFilter is a Ruby script that helps to make your OkCupid experience better by filtering out poor matches.
Ruby
1
star
97

bike-geo

i need help fitting my bike lmao
Haskell
1
star
98

stack-ghci-repro

stack ghci repro
Haskell
1
star
99

job-queue-example

A brief example on two ways of doing a serializable job queue
Haskell
1
star
100

setfield-design-thoughts

Haskell
1
star