[Haskell-cafe] Generating tagfiles for Vim

Vanessa McHale vanessa.mchale at iohk.io
Mon Apr 1 18:09:37 UTC 2019


Unfortunately, fast-tags doesn't work with happy/alex/c2hs preprocessors :(

Cheers

On 4/1/19 10:56 AM, Nathan Merkley wrote:
> While there is probably a better way, my limited knowledge of
> vimscript had me write this and it works well enough
>
>
> function! UpdateHaskellTags()
>     if filereadable("tags")
>         execute "silent !grep -v '" . bufname("%") . "' ./tags >
> __newtags"
>         execute "silent !rm tags"
>         execute "silent !mv __newtags tags"
>         execute "silent !fast-tags " . bufname("%")
>     endif
> endfunction
>
> autocmd BufWritePost *.hs :call UpdateHaskellTags()
> autocmd BufWritePost *.hsc :call UpdateHaskellTags()
>
>
> This uses fast-tags to regenerate tags for the current file on every
> save, but will only work if you are operating from the root of your
> project (or wherever you keep your tags). I use ctrlp for navigation
> so that's never been a problem for me
>
> Nathan Merkley
>
> On Mon, Apr 1, 2019 at 9:26 AM Vanessa McHale <vanessa.mchale at iohk.io
> <mailto:vanessa.mchale at iohk.io>> wrote:
>
>     Hi all,
>
>     I had been using hasktags for tag generation previously, however, I
>     recently discovered that using GHCi with
>
>     cabal new-repl
>     λ:> :ctags
>
>     creates a tags file that actually works with preprocessors (e.g.
>     c2hs or
>     alex or happy).
>
>     Is there any way to run this semi-automatically?
>
>     echo ':ctags' | cabal new-repl
>
>     seems to work in the shell, but I'd like a vim integration if possible
>     (also, it's slow).
>
>     Cheers,
>     Vanessa McHale
>
>
>     _______________________________________________
>     Haskell-Cafe mailing list
>     To (un)subscribe, modify options or view archives go to:
>     http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>     Only members subscribed via the mailman list are allowed to post.
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20190401/e417b678/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20190401/e417b678/attachment.sig>


More information about the Haskell-Cafe mailing list