indent deriving

This commit is contained in:
raichoo 2014-07-05 21:37:17 +02:00
parent 61a5408ced
commit 44e3e6e137

View file

@ -48,7 +48,7 @@ if !exists('g:haskell_indent_do')
endif endif
setlocal indentexpr=GethaskellIndent() setlocal indentexpr=GethaskellIndent()
setlocal indentkeys=!^F,o,O,},0=where,0=in,0=let,<CR> setlocal indentkeys=!^F,o,O,},0=where,0=in,0=let,0=deriving,<CR>
function! GethaskellIndent() function! GethaskellIndent()
let l:prevline = getline(v:lnum - 1) let l:prevline = getline(v:lnum - 1)
@ -59,6 +59,13 @@ function! GethaskellIndent()
return l:s + 2 return l:s + 2
endif endif
if l:line =~ '^\s*\<deriving\>'
let l:s = match(l:prevline, '\<\(newtype\|data\)\>')
if l:s >= 0
return l:s + 2
endif
endif
if l:line =~ '^\s*\<let\>' if l:line =~ '^\s*\<let\>'
let l:s = match(l:prevline, '\<let\>') let l:s = match(l:prevline, '\<let\>')
if l:s != 0 if l:s != 0