[Haskell-cafe] Generating tagfiles for Vim
Nathan Merkley
nathanmerkley at gmail.com
Mon Apr 1 18:19:47 UTC 2019
Benjamin,
Thanks for that, that should come in very handy
Vanessa,
While I haven't tried it, you should be able to replace fast-tags with any
tool of your choice, as the script is just running a sequence of shell
commands. The one caveat is that the script I sent generates tags on a
per-file basis, so if generating them from the repl doesn't merge the tags
file, you will have to change it to instead generate tags for the entire
project directory
Nathan Merkley
On Mon, Apr 1, 2019, 12:10 PM Vanessa McHale <vanessa.mchale at iohk.io> wrote:
> 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>
> 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.
>
> _______________________________________________
> 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/f436f5d2/attachment.html>
More information about the Haskell-Cafe
mailing list