haskell-vim/README.md

91 lines
2.2 KiB
Markdown
Raw Normal View History

2014-06-17 18:32:44 +00:00
Haskell Syntax/Indentation
==========================
I was unhappy with the Haskell scripts that are
2014-06-17 18:32:44 +00:00
shipped with vim, therefore I decided to make my
own based on [idris-vim][].
2014-06-17 18:32:44 +00:00
I hope you find this useful.
2014-06-17 20:28:58 +00:00
![Screenshot](http://raichoo.github.io/images/haskell-vim.png)
2014-06-18 14:56:11 +00:00
## Features
* Covers a broader spectrum of keywords
2014-07-05 20:36:25 +00:00
* Highlighting for new features like type families, pattern synonyms, arrow syntax, recursive do
2014-06-18 14:56:11 +00:00
* More contextual highlighting (e.g. highlight 'as' or 'family' only in approriate places)
* Smarter indentation
2014-06-17 20:28:58 +00:00
## Installation
I recommend using [Pathogen][] for installation. Simply clone
this repo into your `~/.vim/bundle` directory and you are ready to go.
cd ~/.vim/bundle
git clone https://github.com/raichoo/haskell-vim.git
### Manual Installation
Copy content into your `~/.vim` directory.
Be sure that the following lines are in your
`.vimrc`
syntax on
filetype on
filetype plugin indent on
2014-08-17 17:18:07 +00:00
2014-06-25 11:19:07 +00:00
## Configuration
2014-06-25 11:45:31 +00:00
### Features
2014-08-16 19:33:37 +00:00
To enable the features you would like to use, just add the according line to your
`.vimrc`.
2014-08-16 19:50:26 +00:00
* `let g:haskell_enable_quantification = 1` to enable highlighting of `forall`
2014-06-25 11:45:31 +00:00
* `let g:haskell_enable_recursivedo = 1` to enable highlighting of `mdo` and `rec`
* `let g:haskell_enable_arrowsyntax = 1` to enable highlighting of `proc`
2014-07-05 20:36:25 +00:00
* `let g:haskell_enable_pattern_synonyms = 1` to enable highlighting of `pattern`
2014-08-16 19:15:48 +00:00
* `let g:haskell_enable_typeroles = 1` to enable highlighting of type roles
2014-06-25 11:45:31 +00:00
2014-06-25 11:19:07 +00:00
### Indentation
2014-08-17 17:21:37 +00:00
To configure indentation in `haskell-vim` you can use the following variables to change indentation depth, just add the according line to your `.vimrc`.
2014-06-25 11:19:07 +00:00
* `let g:haskell_indent_if = 3`
if bool
>>>then ...
>>>else ...
2014-08-17 17:18:07 +00:00
2014-06-25 11:19:07 +00:00
* `let g:haskell_indent_case = 5`
case xs of
>>>>>[] -> ...
>>>>>(y:ys) -> ...
2014-08-17 17:18:07 +00:00
2014-06-25 11:19:07 +00:00
* `let g:haskell_indent_let = 4`
let x = 0 in
>>>>x
2014-08-17 17:18:07 +00:00
2014-06-25 11:19:07 +00:00
* `let g:haskell_indent_where = 6`
where f :: Int -> Int
>>>>>>f x = x
2014-08-17 17:18:07 +00:00
2014-06-25 11:19:07 +00:00
* `let g:haskell_indent_do = 3`
2014-08-17 17:18:07 +00:00
2014-06-25 11:19:07 +00:00
do x <- a
>>>y <- b
2014-08-17 17:18:07 +00:00
2014-08-17 17:19:34 +00:00
* `let g:haskell_indent_in = 1`
2014-08-17 17:18:07 +00:00
let x = 1
>in x
2014-06-25 11:19:07 +00:00
2014-06-17 20:28:58 +00:00
2014-06-17 20:29:59 +00:00
[Pathogen]: https://github.com/tpope/vim-pathogen
[idris-vim]: https://github.com/idris-hackers/idris-vim