-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
24e9ecd
commit f3f21a9
Showing
70 changed files
with
1,323 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Copyright (c) 2014, raichoo | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
Syntax Highlighting and Indentation for Haskell and Cabal | ||
========================================================= | ||
|
||
I was unhappy with the Haskell scripts that are | ||
shipped with vim, therefore I decided to make my | ||
own based on [idris-vim][]. | ||
|
||
I hope you find this useful. | ||
|
||
 | ||
|
||
## Features | ||
|
||
* Covers a broader spectrum of keywords | ||
* Highlighting for new features like type families, pattern synonyms, arrow syntax, recursive do, role annotations, QuasiQuotation | ||
* More contextual highlighting (e.g. highlight 'as' or 'family' only in appropriate places) | ||
* Smarter indentation | ||
* Better Cabal support | ||
|
||
## 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/neovimhaskell/haskell-vim.git | ||
|
||
Be sure that the following lines are in your | ||
`.vimrc` | ||
|
||
|
||
syntax on | ||
filetype plugin indent on | ||
|
||
### Manual Installation | ||
|
||
Copy content into your `~/.vim` directory. | ||
|
||
## Configuration | ||
|
||
### Features | ||
|
||
To enable the features you would like to use, just add the according line to your | ||
`.vimrc`. | ||
|
||
```viml | ||
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall` | ||
let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec` | ||
let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc` | ||
let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern` | ||
let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles | ||
let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static` | ||
let g:haskell_backpack = 1 " to enable highlighting of backpack keywords | ||
``` | ||
|
||
### Highlighting | ||
|
||
`haskell-vim` has an opinionated highlighting. If you do not like that you can switch to | ||
a more traditional mode by setting `g:haskell_classic_highlighting` to `1`. | ||
|
||
Disabling Template Haskell and Quasiquoting syntax is possible by setting | ||
`g:haskell_disable_TH` to `1`. | ||
|
||
### Indentation | ||
|
||
To configure indentation in `haskell-vim` you can use the following variables to change indentation depth, just add the according line to your `.vimrc`. | ||
|
||
If you dislike how indentation works you can disable it by setting `g:haskell_indent_disable` to | ||
`1`. | ||
|
||
Additionally you can use the | ||
[vim-hindent](https://github.com/alx741/vim-hindent) plugin to achieve automatic | ||
indentation using *hindent*. | ||
|
||
#### Haskell | ||
|
||
* `let g:haskell_indent_if = 3` | ||
|
||
if bool | ||
>>>then ... | ||
>>>else ... | ||
|
||
* `let g:haskell_indent_case = 2` | ||
|
||
case xs of | ||
>>[] -> ... | ||
>>(y:ys) -> ... | ||
|
||
* `let g:haskell_indent_let = 4` | ||
|
||
let x = 0 in | ||
>>>>x | ||
|
||
* `let g:haskell_indent_where = 6` | ||
|
||
where f :: Int -> Int | ||
>>>>>>f x = x | ||
|
||
* `let g:haskell_indent_before_where = 2` | ||
|
||
foo | ||
>>where | ||
|
||
* `let g:haskell_indent_after_bare_where = 2` | ||
|
||
where | ||
>>foo | ||
|
||
* `let g:haskell_indent_do = 3` | ||
|
||
do x <- a | ||
>>>y <- b | ||
|
||
* `let g:haskell_indent_in = 1` | ||
|
||
let x = 1 | ||
>in x | ||
|
||
* `let g:haskell_indent_guard = 2` | ||
|
||
f x y | ||
>>| | ||
|
||
`haskell-vim` also supports an alterative style for `case` indentation. | ||
|
||
* `let g:haskell_indent_case_alternative = 1` | ||
|
||
f xs ys = case xs of | ||
>>[] -> ... | ||
>>(y:ys) -> ... | ||
|
||
|
||
#### Cabal | ||
|
||
* `let g:cabal_indent_section = 2` (limited to max. 4 spaces) | ||
|
||
executable name | ||
>>main-is: Main.hs | ||
|
||
|
||
[Pathogen]: https://github.com/tpope/vim-pathogen | ||
[idris-vim]: https://github.com/idris-hackers/idris-vim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
setlocal comments=s1fl:{-,mb:-,ex:-},:-- | ||
setlocal iskeyword+=-,.,* | ||
setlocal commentstring=--\ %s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
setlocal comments=s1fl:{-,mb:\ \ ,ex:-},:-- | ||
setlocal iskeyword+=' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
*haskell-vim.txt* Last Change 2016 March 14 | ||
=============================================================================== | ||
=============================================================================== | ||
|
||
=============================================================================== | ||
CONTENTS *haskell-vim-contents* | ||
|
||
1. Features |haskell-vim-features| | ||
2. Configuration |haskell-vim-configuration| | ||
3. Highlighting |haskell-vim-indentation| | ||
|
||
=============================================================================== | ||
FEATURES *haskell-vim-features* | ||
|
||
* Covers a broader spectrum of keywords | ||
* Highlighting for new features like type families, pattern synonyms, | ||
arrow syntax, recursive do, role annotations, QuasiQuotation | ||
* More contextual highlighting | ||
(e.g. highlight "as" or "family" only in appropriate places) | ||
* Smarter indentation | ||
* Better Cabal support | ||
|
||
=============================================================================== | ||
CONFIGURATION *haskell-vim-configuration* | ||
|
||
To enable the features you would like to use, just add the according line to | ||
your `.vimrc`. | ||
|
||
=============================================================================== | ||
HIGHLIGHTING *haskell-vim-highlighting* | ||
|
||
`haskell-vim` can highlight additional keywords. This is enabled by setting | ||
the according variable to 1 in the `.vimrc`. | ||
|
||
* |haskell-vim-enable-quantification| | ||
* |haskell-vim-enable-recursivedo| | ||
* |haskell-vim-enable-arrowsyntax| | ||
* |haskell-vim-enable-pattern-synonyms| | ||
* |haskell-vim-enable-typeroles| | ||
* |haskell-vim-enable-static-pointers| | ||
* |haskell-vim-classic-highlighting| | ||
* |haskell-vim-disable-TH| | ||
|
||
*haskell-vim-enable-quantification* | ||
`g:haskell_enable_quantification` Enables highlighting of `forall`. | ||
|
||
*haskell-vim-enable-recursivedo* | ||
`g:haskell_enable_recursivedo` Enables highlighting of `mdo` and `rec`. | ||
|
||
*haskell-vim-enable-arrowsyntax* | ||
`g:haskell_enable_arrowsyntax` Enables highlighting of `proc`. | ||
|
||
*haskell-vim-enable-pattern-synonyms* | ||
`g:haskell_enable_pattern_synonyms` Enables highlighting of the `pattern` keyword. | ||
|
||
*haskell-vim-enable-typeroles* | ||
`g:haskell_enable_typeroles` Enables highlighting of the `role` keyword, as | ||
well as `phantom`, `norminal` and | ||
`representational`. | ||
|
||
*haskell-vim-enable-static-pointers* | ||
`g:haskell_enable_static_pointers` Enables highlighting of the `static` keyword. | ||
|
||
*haskell-vim-classic-highlighting* | ||
`haskell-vim` has an opinionated highlighting. If you do not like that you can | ||
switch to a more traditional mode by setting `g:haskell_classic_highlighting` | ||
to 1. | ||
|
||
*haskell-vim-disable-TH* | ||
Disabling Template Haskell and Quasiquoting syntax is possible by setting | ||
`g:haskell_disable_TH` to `1`. | ||
|
||
=============================================================================== | ||
INDENTATION *haskell-vim-indentation* | ||
|
||
To configure indentation in `haskell-vim` you can use the following variables to | ||
change indentation depth, just add the according line to your `.vimrc`. | ||
|
||
You can disable the indentation by setting `g:haskell_indent_disable` to `1`. | ||
|
||
Haskell~ | ||
|
||
* |haskell-vim-indent-if| | ||
* |haskell-vim-indent-case| | ||
* |haskell-vim-indent-let| | ||
* |haskell-vim-indent-where| | ||
* |haskell-vim-indent-before-where| | ||
* |haskell-vim-indent-after-bare-where| | ||
* |haskell-vim-indent-do| | ||
* |haskell-vim-indent-in| | ||
* |haskell-vim-indent-guard| | ||
*haskell-vim-indent-if* | ||
* let g:haskell_indent_if = 3 > | ||
|
||
if bool | ||
>>>then ... | ||
>>>else ... | ||
< | ||
|
||
*haskell-vim-indent-case* | ||
* let g:haskell_indent_case = 2 > | ||
|
||
case xs of | ||
>>[] -> ... | ||
>>(y:ys) -> ... | ||
< | ||
*haskell-vim-indent-let* | ||
* let g:haskell_indent_let = 4 > | ||
|
||
let x = 0 in | ||
>>>>x | ||
< | ||
*haskell-vim-indent-where* | ||
* let g:haskell_indent_where = 6 > | ||
|
||
where f :: Int -> Int | ||
>>>>>>f x = x | ||
< | ||
*haskell-vim-indent-before-where* | ||
* let g:haskell_indent_before_where = 2 > | ||
|
||
foo | ||
>>where | ||
< | ||
*haskell-vim-indent-after-bare-where* | ||
* let g:haskell_indent_after_bare_where = 2 > | ||
|
||
where | ||
>>foo | ||
< | ||
*haskell-vim-indent-do* | ||
* let g:haskell_indent_do = 3 > | ||
|
||
do x <- a | ||
>>>y <- b | ||
< | ||
*haskell-vim-indent-in* | ||
* let g:haskell_indent_in = 1 > | ||
|
||
let x = 1 | ||
>in x | ||
< | ||
*haskell-vim-indent-guard* | ||
* let g:haskell_indent_guard = 2 > | ||
|
||
f x y | ||
>>| | ||
< | ||
|
||
Cabal~ | ||
|
||
* |cabal-vim-indent-section| | ||
|
||
*cabal-vim-indent-section* | ||
* let g:cabal_indent_section = 2 (limited to max. 4 spaces) > | ||
|
||
executable name | ||
>>main-is: Main.hs | ||
< |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
au BufRead,BufNewFile *.hsc set filetype=haskell | ||
au BufRead,BufNewFile *.bpk set filetype=haskell | ||
au BufRead,BufNewFile *.hsig set filetype=haskell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
" indentation for cabal | ||
" | ||
" author: raichoo ([email protected]) | ||
" | ||
if exists('b:did_indent') | ||
finish | ||
endif | ||
|
||
let b:did_indent = 1 | ||
|
||
if !exists('g:cabal_indent_section') | ||
"executable name | ||
">>main-is: Main.hs | ||
">>hs-source-dirs: src | ||
let g:cabal_indent_section = 2 | ||
elseif exists('g:cabal_indent_section') && g:cabal_indent_section > 4 | ||
let g:cabal_indent_section = 4 | ||
endif | ||
|
||
setlocal indentexpr=GetCabalIndent() | ||
setlocal indentkeys=!^F,o,O,<CR> | ||
|
||
function! GetCabalIndent() | ||
let l:prevline = getline(v:lnum - 1) | ||
|
||
if l:prevline =~ '\C^\(executable\|library\|flag\|source-repository\|test-suite\|benchmark\)' | ||
return g:cabal_indent_section | ||
else | ||
return match(l:prevline, '\S') | ||
endif | ||
endfunction |
Oops, something went wrong.