Skip to content

Commit

Permalink
autotags
Browse files Browse the repository at this point in the history
  • Loading branch information
dag committed Apr 2, 2012
1 parent 4db1614 commit d14c097
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
8 changes: 8 additions & 0 deletions autoload/vim2hs/haskell/tags.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function! vim2hs#haskell#tags#fasttags() " {{{
silent !find -iname '*.hs' | xargs fast-tags
endfunction " }}}


function! vim2hs#haskell#tags#hasktags() " {{{
silent !hasktags -c --ignore-close-implementation .
endfunction " }}}
14 changes: 14 additions & 0 deletions doc/vim2hs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,19 @@ Whether to add named patterns to Tabular useful for Haskell development. This
is enabled by default if Tabular is installed: >
let g:haskell_tabular = 1
<
*g:haskell_autotags*
Generate a tags file when Vim is started in a directory containing a "*.cabal"
file, and update it when saving "*.hs" files.

See also |g:haskell_tags_generator|.

Disabled by default: >
let g:haskell_autotags = 0
<
*g:haskell_tags_generator*
The program to use for |g:haskell_autotags|. Valid values are "fast-tags" and
"hasktags" and requires the respective packages from Hackage. Default: >
let g:haskell_tags_generator = 'fast-tags'
<

vim:tw=78:et:ft=help:norl:
20 changes: 20 additions & 0 deletions plugin/haskell_tags.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
if glob('*.cabal') ==# ''
finish
endif

call vim2hs#letdefault('g:haskell_autotags' , 0)
call vim2hs#letdefault('g:haskell_tags_generator' , 'fast-tags')

if !g:haskell_autotags
finish
endif

if g:haskell_tags_generator ==# 'fast-tags'
if !executable('fast-tags') | finish | endif
autocmd BufWritePost *.hs call vim2hs#haskell#tags#fasttags()
call vim2hs#haskell#tags#fasttags()
elseif g:haskell_tags_generator == 'hasktags'
if !executable('hasktags') | finish | endif
autocmd BufWritePost *.hs call vim2hs#haskell#tags#hasktags()
call vim2hs#haskell#tags#hasktags()
endif

0 comments on commit d14c097

Please sign in to comment.