Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any good Haskell indentation script for Vim?

Unfortunately, the one Haskell indent script I found (by motemen) breaks when it comes to Haddock comments:

-- |Docline 1, lorem ipsum<CR>
    -- Docline 2
^^^^ - an autoindent here, wtf

Would anyone happen to know about a better alternative?

like image 323
Jakub Lédl Avatar asked May 19 '12 09:05

Jakub Lédl


People also ask

Does indentation matter Haskell?

Even though the consensus among Haskell programmers is that meaningful indentation leads to better-looking code, understanding how to convert from one style to the other can help understand the indentation rules.

Is Haskell indentation sensitive?

No, Haskell indentation is not like Python. Haskell is not about indentation levels, it's all about making things line up with other things.


2 Answers

Okay, so after even more googling, I found this indent script:

https://github.com/kana/vim-filetype-haskell/blob/master/indent/haskell.vim

It seems to work almost perfectly (ignores if..then.. else and let). But to be honest, the fact that it doesn't break my documentation makes it good enough right now :)

like image 171
Jakub Lédl Avatar answered Oct 13 '22 04:10

Jakub Lédl


I've no problems with haskellmode-vim

edit: FWIW, I've found this reddit thread recently. vim2hs looks nice to me, also regarding indentation.

like image 27
lewurm Avatar answered Oct 13 '22 04:10

lewurm