caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Announce: annot looks up types in *.annot files
@ 2006-05-17  9:12 Christian Lindig
  2006-06-03 17:25 ` [Caml-list] " Nathaniel Gray
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Lindig @ 2006-05-17  9:12 UTC (permalink / raw)
  To: Caml List


To lookup types of identifiers from within Vim, I have implemented a 
small tool in Ocaml called annot:

	$ annot -type 30 20 main.annot
   	string list

Given a cursor position (line 30, column 20) it looks up the type 
annotation for that position in main.annot. It is trivial to hook this 
to a key in Vim, and probably most other editors.

function! OCamlType()
     let col  = col('.')
     let line = line('.')
     let file = expand("%:p:r")
     echo system("annot -n -type " . line . " " . col . " " . file . 
".annot")
endfunction
map ,t :call OCamlType()<return>

I'm well aware that Vim and Emacs have their own solutions, using their 
own scripting languages, but I think it is better to have one general 
solution.

You can download the tool from my subversion repository; it is released 
under a BSD-style license.

	svn co svn://svn.vistabella.de/annot

The tool should build on Unix systems, comes with ./configure, and a 
manual page. Let me know if there are any problems. Of course, positive 
feedback is also welcome.

-- Christian

--
http://www.st.cs.uni-sb.de/~lindig/


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Announce: annot looks up types in *.annot files
  2006-05-17  9:12 Announce: annot looks up types in *.annot files Christian Lindig
@ 2006-06-03 17:25 ` Nathaniel Gray
  0 siblings, 0 replies; 2+ messages in thread
From: Nathaniel Gray @ 2006-06-03 17:25 UTC (permalink / raw)
  To: Christian Lindig; +Cc: Caml List

On 5/17/06, Christian Lindig <lindig@cs.uni-sb.de> wrote:
>
> To lookup types of identifiers from within Vim, I have implemented a
> small tool in Ocaml called annot:
>
>         $ annot -type 30 20 main.annot
>         string list
>
> Given a cursor position (line 30, column 20) it looks up the type
> annotation for that position in main.annot. It is trivial to hook this
> to a key in Vim, and probably most other editors.

Thanks!  This looks really handy.

Cheers,
-n8

-- 
>>>-- Nathaniel Gray -- Caltech Computer Science ------>
>>>-- Mojave Project -- http://mojave.cs.caltech.edu -->


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-06-03 17:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-17  9:12 Announce: annot looks up types in *.annot files Christian Lindig
2006-06-03 17:25 ` [Caml-list] " Nathaniel Gray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).