This is a very simple plugin that generates Vim commands to add or remove the extension pragmas. Different GHC versions support different extensions, so the output of
$ ghc --supported-languagesis used to determine what commands to generate. It should be fairly robust: --supported-languages
switch exists since at least GHC 7.6. The plugin supports pathogen, so
to install it just run:
mkdir -p ~/.vim/bundle && cd ~/.vim/bundle && git clone git@github.com:supki/vim-languagesBy default, the commands for the following extensions are generated:
NoImplicitPrelude,NoMonomorphismRestriction- Any extension that does not have
Noprefix butRank2TypesandNPlusKPatterns
The command name is the name of the extension, so
:RankNTypeswill add
{-# LANGUAGE RankNTypes #-}Another call to :RankNTypes will remove the pragma.
The list of commands to generate is customizable:
-
Add
let g:vim_languages_exclude = ['Rank2Types', 'NPlusKPatterns', ...]line to your~/.vimrcto exclude more commands from being generated -
Add
let g:vim_languages_include = ['NoImplicitPrelude', 'NoMonomorphismRestriction]line to your~/.vimrcto generate more commands -
Inclusion has a higher precedence
Note that the plugin expects the file to have all LANGUAGE pragmas as one big block at the top; it tolerates the single line comment syntax and pre-processor instructions but nothing else (e.g. OPTIONS_GHC pragmas interspersed in the list of LANGUAGE pragmas will break everything)
