diff options
Diffstat (limited to 'ftplugin/haskell.vim')
-rw-r--r-- | ftplugin/haskell.vim | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/ftplugin/haskell.vim b/ftplugin/haskell.vim index 3e9c43f8..b1028620 100644 --- a/ftplugin/haskell.vim +++ b/ftplugin/haskell.vim @@ -6,20 +6,15 @@ endif let g:loaded_haskellvim_haskell = 1 -function! haskell#makeModuleCommentBlock() - let l:commenttmpl = [ '{-|', - \ 'Module : ', - \ 'Description : ', - \ 'Copyright : ', - \ 'License : ', - \ 'Maintainer : ', - \ 'Stability : ', - \ 'Portability : ', - \ '-}'] +function! haskell#sortImports(line1, line2) + exe a:line1 . "," . a:line2 . "sort /import\\s\\+\\(qualified\\s\\+\\)\\?/" +endfunction - exe "normal ggO" . join(l:commenttmpl, "\n") +function! haskell#formatImport(line1, line2) + exec a:line1 . ",". a:line2 . "s/import\\s\\+\\([A-Z].*\\)/import \\1" endfunction -command! -buffer -nargs=0 HaskellAddModuleComment call haskell#makeModuleCommentBlock() +command! -buffer -range HaskellSortImports call haskell#sortImports(<line1>, <line2>) +command! -buffer -range HaskellFormatImport call haskell#formatImport(<line1>, <line2>) endif |