diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2015-10-18 16:08:51 +0200 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2015-10-18 16:08:51 +0200 | 
| commit | 1f1e821192d25d630587aa9d53bd8d428fb09c4d (patch) | |
| tree | 7b342264b1c5e2e8d2a644fbff86204061530fd4 /ftplugin | |
| parent | ae882e85f81869dbf81b5c888c337aa4481fc8c3 (diff) | |
| download | vim-polyglot-1f1e821192d25d630587aa9d53bd8d428fb09c4d.tar.gz vim-polyglot-1f1e821192d25d630587aa9d53bd8d428fb09c4d.zip | |
Change haskell provider to neovimhaskell/haskell-vim, closes #75v2.2.2
Diffstat (limited to '')
| -rw-r--r-- | ftplugin/cabal.vim | 69 | ||||
| -rw-r--r-- | ftplugin/haskell.vim | 25 | 
2 files changed, 94 insertions, 0 deletions
| diff --git a/ftplugin/cabal.vim b/ftplugin/cabal.vim new file mode 100644 index 00000000..0942397c --- /dev/null +++ b/ftplugin/cabal.vim @@ -0,0 +1,69 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haskell') == -1 +   +if exists("g:loaded_haskellvim_cabal") +  finish +endif + +let g:loaded_haskellvim_cabal = 1 + +function! s:makeSection(content) +  return "\n" . join(a:content, "\n") +endfunction + +function! s:exeTmpl(name, src) +  let l:exetmpl = [ 'executable ' . a:name, +                  \ '-- ghc-options:', +                  \ 'main-is:             ' . a:src, +                  \ '-- other-modules:', +                  \ '-- other-extensions:', +                  \ 'build-depends:       base', +                  \ '-- hs-source-dirs:', +                  \ 'default-language:    Haskell2010' +                  \ ] + +  return s:makeSection(l:exetmpl) +endfunction + +function! s:libTmpl() +  let l:libtmpl = [ 'library', +                  \ '-- ghc-options:', +                  \ '-- other-modules:', +                  \ '-- other-extensions:', +                  \ 'build-depends:       base', +                  \ '-- hs-source-dirs:', +                  \ 'default-language:    Haskell2010' +                  \ ] + +  return s:makeSection(l:libtmpl) +endfunction + +function! s:flagTmpl(name) +  let l:flagtmpl = [ 'flag ' . a:name, +                   \ 'description:', +                   \ 'default:      False', +                   \ 'manual:       True', +                   \ ] + +  return s:makeSection(l:flagtmpl) +endfunction + +function! cabal#addExecutable() +  let l:name = input("Enter executable name: ") +  let l:src  = input("Enter source file: ") +  exe "normal Go" . s:exeTmpl(l:name, l:src) +endfunction + +function! cabal#addLibrary() +  exe "normal Go" . s:libTmpl() +endfunction + +function! cabal#addFlag() +  let l:name = input("Enter flag name: ") +  exe "normal Go" . s:flagTmpl(l:name) +endfunction + +command! -buffer CabalAddExecutable call cabal#addExecutable() +command! -buffer CabalAddLibrary call cabal#addLibrary() +command! -buffer CabalAddFlag call cabal#addFlag() + +endif diff --git a/ftplugin/haskell.vim b/ftplugin/haskell.vim new file mode 100644 index 00000000..3e9c43f8 --- /dev/null +++ b/ftplugin/haskell.vim @@ -0,0 +1,25 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haskell') == -1 +   +if exists("g:loaded_haskellvim_haskell") +  finish +endif + +let g:loaded_haskellvim_haskell = 1 + +function! haskell#makeModuleCommentBlock() +  let l:commenttmpl = [ '{-|', +                      \ 'Module      : ', +                      \ 'Description : ', +                      \ 'Copyright   : ', +                      \ 'License     : ', +                      \ 'Maintainer  : ', +                      \ 'Stability   : ', +                      \ 'Portability : ', +                      \ '-}'] + +  exe "normal ggO" . join(l:commenttmpl, "\n") +endfunction + +command! -buffer -nargs=0 HaskellAddModuleComment call haskell#makeModuleCommentBlock() + +endif | 
