summaryrefslogtreecommitdiffstats
path: root/ftplugin/haskell.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2016-05-02 10:42:37 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2016-05-02 10:42:37 +0200
commit5dd1a7e83966c92d220073185f1738dfe441f59e (patch)
tree9c4bee389a51a9bb111dcc894c9db0f6d1809d81 /ftplugin/haskell.vim
parentbc098370c1bb81840734f5764f431dee270e75ce (diff)
downloadvim-polyglot-5dd1a7e83966c92d220073185f1738dfe441f59e.tar.gz
vim-polyglot-5dd1a7e83966c92d220073185f1738dfe441f59e.zip
Update
Diffstat (limited to 'ftplugin/haskell.vim')
-rw-r--r--ftplugin/haskell.vim19
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