From 5dd1a7e83966c92d220073185f1738dfe441f59e Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Mon, 2 May 2016 10:42:37 +0200 Subject: Update --- ftplugin/haskell.vim | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'ftplugin/haskell.vim') 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(, ) +command! -buffer -range HaskellFormatImport call haskell#formatImport(, ) endif -- cgit v1.2.3