All Projects → travitch → Hasksyn

travitch / Hasksyn

Licence: other
A vim mode for Haskell

Labels

Projects that are alternatives of or similar to Hasksyn

Vim Refact
Some refactoring stuff for Vim
Stars: ✭ 21 (-38.24%)
Mutual labels:  viml
Vim Llvmcov
The llvm-cov tool shows code coverage information for programs that are instrumented to emit profile data.
Stars: ✭ 30 (-11.76%)
Mutual labels:  viml
Vim Readline
Readline bindings for Insert Mode
Stars: ✭ 33 (-2.94%)
Mutual labels:  viml
Vim Monokai Refined
Port of Monokai Refined for TextMate/Sublime Text, using sickill's Coloration converter
Stars: ✭ 27 (-20.59%)
Mutual labels:  viml
Linters.vim
Automatically run linters over your code as you write it
Stars: ✭ 28 (-17.65%)
Mutual labels:  viml
Dotfiles
Some of my configuration.
Stars: ✭ 31 (-8.82%)
Mutual labels:  viml
Vim Notebook
Vim plugin to annotate text, source code, etc
Stars: ✭ 21 (-38.24%)
Mutual labels:  viml
Tskeleton vim
File Templates and Code Skeletons/Snippets for VIM
Stars: ✭ 33 (-2.94%)
Mutual labels:  viml
Vim Yankring
Mirror of yankring.vim
Stars: ✭ 28 (-17.65%)
Mutual labels:  viml
Codeschool Vim Theme
codeschool vim theme
Stars: ✭ 32 (-5.88%)
Mutual labels:  viml
Vimrc
vgod's vimrc
Stars: ✭ 944 (+2676.47%)
Mutual labels:  viml
Vim Dragvisuals
Vim global plugin for dragging virtual blocks
Stars: ✭ 28 (-17.65%)
Mutual labels:  viml
Vim Hl Var
Stars: ✭ 32 (-5.88%)
Mutual labels:  viml
Vim Sol
On the Path of Illumination ! :)
Stars: ✭ 27 (-20.59%)
Mutual labels:  viml
Vim Fuzzysearch
Fuzzy pattern building, in any buffer
Stars: ✭ 33 (-2.94%)
Mutual labels:  viml
Vim Jade
Vim syntax highlighting for the Jade templating engine.
Stars: ✭ 21 (-38.24%)
Mutual labels:  viml
Php Vim
make vim as a php ide
Stars: ✭ 30 (-11.76%)
Mutual labels:  viml
Ftcolor.vim
Switches colorschemes according to the file type.
Stars: ✭ 34 (+0%)
Mutual labels:  viml
Cscope maps
cscope keyboard mappings for VIM
Stars: ✭ 33 (-2.94%)
Mutual labels:  viml
Vimix
Vimux with Elixir Mix Integration
Stars: ✭ 32 (-5.88%)
Mutual labels:  viml

Introduction

hasksyn is a vim plugin to highlight and indent Haskell source code. It is written almost entirely from scratch and has slightly different goals than the original Haskell syntax highlighting code. Most importantly, this version explicitly does not handle Literate Haskell files at all. In exchange, it provides more comprehensive syntax highlighting for normal Haskell code, along with fairly reasonable indentation. It also includes improved highlighting for cabal files.

Unlike haskellmode-vim and vim2hs, this package does not support running external tools over code in fancy ways or recognizing cabal files.

Screenshot

Here is a screenshot of the syntax highlighting (included in the demos directory):

screenshot

Stability

This mode seems to work reasonably well. That said, it hasn't been thoroughly tested. Additionally, configuration options are still subject to change.

Performance

I've tested things out on files around 1000 lines and it seems to perform well. I don't see a visible slowdown with this code, whereas vim2hs was pegging a CPU while scrolling. The indent code can do a non-trivial amount of work, but it does not really seem to be an issue.

TODO

  • Highlighting for mdo, proc, and rec
  • Nesting block comments inside of haddock block documentation comments
  • Indentation for quasi-quotes (maybe)
  • More clever indentation, where sensible

Requirements

The code has only been tested with vim 7.3, but it should work for almost any reasonable version. Feel free to report bugs; I'll try to support all reasonable versions. There is also no platform-specific code.

Indentation Policy

As far as I can tell, this package should provide better Haskell indentation than other modes. Here is a brief overview of its features:

  • Smart handling of comments and strings; it should be doing the right thing almost all of the time. The expected exception is if you are inside of a very long block comment where the comment beginning is farther back than the search allowance.

  • Indent after where/case .. of/operators at the end of lines

  • Align | and ,

  • Align bindings in let expressions, and snap in to its proper spot

  • De-indent after return at the end of a do block.

  • De-indent after the catchall case of a case expression.

Installation

With pathogen

Just clone into the standard pathogen location:

cd ~/.vim/bundle
git clone git://github.com/travitch/hasksyn.git

If you use git submodules:

cd ~/.vim
git submodule add git://github.com/travitch/hasksyn.git bundle/hasksyn

Manually

git clone git://github.com/travitch/hasksyn.git
cd hasksyn
cp -R * ~/.vim

Configuration

Below are the configuration options available, along with their default values. If you want to change them, just copy the relevant line into your ~/.vimrc.

Indentation

" How many lines should be searched for context
let g:hasksyn_indent_search_backward = 100

" Should we try to de-indent after a return
let g:hasksyn_dedent_after_return = 1

" Should we try to de-indent after a catchall case in a case .. of
let g:hasksyn_dedent_after_catchall_case = 1

Notes

If you use rainbow_parentheses, do not enable RainbowParenthesesLoadBraces for Haskell files. It seems to interfere with highlighting block comments.

I have also disabled so-called three part comments for Haskell. These look like:

{-
 -
 -
 -}

These are three-part comments because of the start token {-, the middle token -, and the end token -}. Whatever vim does to make this magic happen was interfering with the indentation script, so I disabled it. I also find it kind of obnoxious. If you really want it back, I could make that configurable or you can just use ~/.vim/after/ftplugin/haskell.vim.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].