" Vim indent file " Language: Haskell " Author: motemen " Version: 0.1 " Last Change: 2007-07-25 " " Modify g:haskell_indent_if and g:haskell_indent_case to " change indentation for `if'(default 3) and `case'(default 5). " Example (in .vimrc): " > let g:haskell_indent_if = 2 if exists('b:did_indent') finish endif let b:did_indent = 1 if !exists('g:haskell_indent_if') " if bool " >>>then ... " >>>else ... let g:haskell_indent_if = 3 endif if !exists('g:haskell_indent_case') " case xs of " >>>>>[] -> ... " >>>>>(y:ys) -> ... let g:haskell_indent_case = 5 endif setlocal indentexpr=GetHaskellIndent() setlocal indentkeys=!^F,o,O function! GetHaskellIndent() let line = substitute(getline(getpos('.')[1] - 1), '\t', repeat(' ', &tabstop), 'g') if line =~ '[!#$%&*+./<=>?@\\^|~-]$\|\' let s = match(line, '\.*\&.*\zs\') if s > 0 return s endif let s = match(line, '\') if s > 0 return s + g:haskell_indent_if endif endif let s = match(line, '\ 0 return s endif let s = match(line, '\') if s > 0 return s + g:haskell_indent_case endif return match(line, '\S') endfunction