Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Happy Haskell programming on Vim, powered by ghc-mod
VimL Haskell Shell
branch: master


Build Status Gitter chat

Happy Haskell programming on Vim, powered by ghc-mod


  • Displaying the type of sub-expressions (ghc-mod type)
  • Displaying error/warning messages and their locations (ghc-mod check and ghc-mod lint)
  • Displaying the expansion of splices (ghc-mod expand)

Completions are supported by another plugin. See neco-ghc .



ghcmod.vim contains ftplugin. Please make sure that filetype plugin is enabled. To check it, type :filetype and you would see something like this: filetype detection:ON plugin:ON indent:ON. You can enable it by :filetype plugin on. I highly recommend adding filetype plugin indent on to your vimrc. See :help :filetype-overview for more details.


ghc-mod >= 4.1.0

cabal install ghc-mod


If you'd like to give GHC options, set g:ghcmod_ghc_options.

let g:ghcmod_ghc_options = ['-idir1', '-idir2']

Also, there's buffer-local version b:ghcmod_ghc_options.

autocmd BufRead,BufNewFile ~/.xmonad/* call s:add_xmonad_path()
function! s:add_xmonad_path()
  if !exists('b:ghcmod_ghc_options')
    let b:ghcmod_ghc_options = []
  call add(b:ghcmod_ghc_options, '-i' . expand('~/.xmonad/lib'))

:GhcModType, :GhcModTypeClear

Type :GhcModType on a expression, then the sub-expression is highlighted and its type is echoed. If you type :GhcModType multiple times, the sub-expression changes.

  1. type1
  2. type2
  3. type3
  4. type4
  5. type5

Since ghc-mod 1.10.8, not only sub-expressions but name bindings and sub-patterns are supported.

  • type-bind
  • type-pat

Type :GhcModTypeClear to clear sub-expression's highlight.

Sub-expressions are highlighted as Search by default. You can customize it by setting g:ghcmod_type_highlight .

hi ghcmodType ctermbg=yellow
let g:ghcmod_type_highlight = 'ghcmodType'

:GhcModCheck, :GhcModLint

You can get compiler errors/warnings by :GhcModCheck and they are available in quickfix window.


Similarly, type :GhcModLint to get suggestions by ghc-mod lint.

If you'd like to pass options to hlint, set g:ghcmod_hlint_options.

let g:ghcmod_hlint_options = ['--ignore=Redundant $']


If you'd like to open in another way the quickfix, set g:ghcmod_open_quickfix_function.

let g:ghcmod_open_quickfix_function = 'GhcModQuickFix'
function! GhcModQuickFix()
  " for unite.vim and unite-quickfix
  :Unite -no-empty quickfix

  " for ctrlp

  " for FuzzyFinder

:GhcModCheckAsync, :GhcModLintAsync, :GhcModCheckAndLintAsync

You can run check and/or lint asynchronously.

This would be useful when you'd like to run check and/or lint automatically (especially on BufWritePost). See Customize wiki page for more detail.


You can see the expansion of splices by :GhcModExpand and they are available in quickfix window.


This feature was introduced since ghc-mod 1.10.10.


See wiki page Customize.


BSD3 License, the same license as ghc-mod.

Copyright (c) 2012-2013, eagletmt

Something went wrong with that request. Please try again.